vxe-table-plugin-menus
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -8,3 +8,3 @@ "use strict"; | ||
var _xeUtils = _interopRequireDefault(require("xe-utils")); | ||
var _xeUtils = _interopRequireDefault(require("xe-utils/methods/xe-utils")); | ||
@@ -214,6 +214,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function checkPrivilege(item, _ref31) { | ||
var columns = _ref31.columns, | ||
column = _ref31.column; | ||
function checkPrivilege(item, params) { | ||
var code = item.code; | ||
var columns = params.columns, | ||
column = params.column; | ||
@@ -294,5 +294,5 @@ switch (code) { | ||
var VXETablePluginMenus = { | ||
install: function install(_ref32) { | ||
var menus = _ref32.menus, | ||
interceptor = _ref32.interceptor; | ||
install: function install(VXETable) { | ||
var interceptor = VXETable.interceptor, | ||
menus = VXETable.menus; | ||
interceptor.add('event.show_menu', handlePrivilegeEvent); | ||
@@ -299,0 +299,0 @@ menus.mixin(menuMap); |
@@ -225,6 +225,6 @@ (function (global, factory) { | ||
function checkPrivilege(item, _ref31) { | ||
var columns = _ref31.columns, | ||
column = _ref31.column; | ||
function checkPrivilege(item, params) { | ||
var code = item.code; | ||
var columns = params.columns, | ||
column = params.column; | ||
@@ -305,5 +305,5 @@ switch (code) { | ||
var VXETablePluginMenus = { | ||
install: function install(_ref32) { | ||
var menus = _ref32.menus, | ||
interceptor = _ref32.interceptor; | ||
install: function install(VXETable) { | ||
var interceptor = VXETable.interceptor, | ||
menus = VXETable.menus; | ||
interceptor.add('event.show_menu', handlePrivilegeEvent); | ||
@@ -310,0 +310,0 @@ menus.mixin(menuMap); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){if("function"==typeof define&&define.amd)define("vxe-table-plugin-menus",["exports","xe-utils"],t);else if("undefined"!=typeof exports)t(exports,require("xe-utils"));else{var a={exports:{}};t(a.exports,e.XEUtils),e.VXETablePluginMenus=a.exports.default}}(this,function(e,o){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.VXETablePluginMenus=void 0,o=(t=o)&&t.__esModule?t:{default:t};var a={CLEAR_CELL:function(e){var t=e.$table,a=e.row,n=e.column;a&&n&&t.clearData(a,n.property)},CLEAR_ROW:function(e){var t=e.$table,a=e.row;a&&t.clearData(a)},CLEAR_SELECTION_ROW:function(e){var t=e.$table;t.clearData(t.getSelectRecords())},CLEAR_ALL:function(e){e.$table.clearData()},REVERT_CELL:function(e){var t=e.$table,a=e.row,n=e.column;a&&n&&t.revertData(a,n.property)},REVERT_ROW:function(e){var t=e.$table,a=e.row;a&&t.revertData(a)},REVERT_SELECTION_ROW:function(e){var t=e.$table;t.revertData(t.getSelectRecords())},REVERT_ALL:function(e){e.$table.revertData()},INSERT_ROW:function(e){var t=e.$table,a=e.menu;t.insert(a.params)},INSERT_ACTIVED_ROW:function(e){var a=e.$table,t=e.menu,n=e.column,r=t.params||[];a.insert(r[0]).then(function(e){var t=e.row;return a.setActiveCell(t,r[1]||n.property)})},INSERT_AT_ROW:function(e){var t=e.$table,a=e.menu,n=e.row;n&&t.insertAt(a.params,n)},INSERT_AT_ACTIVED_ROW:function(e){var a=e.$table,t=e.menu,n=e.row,r=e.column;if(n){var o=t.params||[];a.insertAt(o[0],n).then(function(e){var t=e.row;return a.setActiveCell(t,o[1]||r.property)})}},DELETE_ROW:function(e){var t=e.$table,a=e.row;a&&t.remove(a)},DELETE_SELECTION_ROW:function(e){e.$table.removeSelecteds()},DELETE_ALL:function(e){e.$table.remove()},CLEAR_SORT:function(e){e.$table.clearSort()},SORT_ASC:function(e){var t=e.$table,a=e.column;a&&t.sort(a.property,"asc")},SORT_DESC:function(e){var t=e.$table,a=e.column;a&&t.sort(a.property,"desc")},CLEAR_FILTER:function(e){var t=e.$table,a=e.column;a&&t.clearFilter(a.property)},CLEAR_ALL_FILTER:function(e){e.$table.clearFilter()},FILTER_CELL:function(e){var t=e.$table,a=e.row,n=e.column;if(a&&n){var r=n.property;t.filter(r).then(function(e){if(e.length){var t=e[0];t.data=o.default.get(a,r),t.checked=!0}}).then(function(){return t.updateData()})}},EXPORT_ROW:function(e){var t=e.$table,a=e.menu,n=e.row;if(n){var r={data:[n]};t.exportCsv(a.params?o.default.assign(r,a.params[0]):r)}},EXPORT_SELECTION_ROW:function(e){var t=e.$table,a=e.menu,n={data:t.getSelectRecords()};t.exportCsv(a.params?o.default.assign(n,a.params[0]):n)},EXPORT_ALL:function(e){e.$table.exportCsv()},HIDDEN_COLUMN:function(e){var t=e.$table;e.column&&t.hideColumn()},RESET_COLUMN:function(e){e.$table.resetCustoms()},RESET_RESIZABLE:function(e){e.$table.resetResizable()},RESET_ALL:function(e){e.$table.resetAll()}};function n(e,t){var a=t.columns,n=t.column,r=e.code;switch(r){case"CLEAR_SORT":e.disabled=!a.some(function(e){return e.sortable&&e.order});break;case"CLEAR_ALL_FILTER":e.disabled=!a.some(function(e){return e.filters&&e.filters.some(function(e){return e.checked})});break;case"CLEAR_CELL":case"CLEAR_ROW":case"REVERT_CELL":case"REVERT_ROW":case"INSERT_AT_ROW":case"INSERT_AT_ACTIVED_ROW":case"DELETE_ROW":case"SORT_ASC":case"SORT_DESC":case"CLEAR_FILTER":case"FILTER_CELL":case"EXPORT_ROW":case"HIDDEN_COLUMN":if(e.disabled=!n,!e.disabled)switch(r){case"SORT_ASC":case"SORT_DESC":e.disabled=!n.sortable;break;case"FILTER_CELL":case"CLEAR_FILTER":if(e.disabled=!n.filters||!n.filters.length,!e.disabled)switch(r){case"CLEAR_FILTER":e.disabled=!n.filters.some(function(e){return e.checked})}}}}function r(t){t.options.forEach(function(e){e.forEach(function(e){n(e,t),e.children&&e.children.forEach(function(e){n(e,t)})})})}var c={install:function(e){var t=e.menus;e.interceptor.add("event.show_menu",r),t.mixin(a)}};e.VXETablePluginMenus=c,"undefined"!=typeof window&&window.VXETable&&window.VXETable.use(c);var i=c;e.default=i}); | ||
!function(e,t){if("function"==typeof define&&define.amd)define("vxe-table-plugin-menus",["exports","xe-utils"],t);else if("undefined"!=typeof exports)t(exports,require("xe-utils"));else{var a={exports:{}};t(a.exports,e.XEUtils),e.VXETablePluginMenus=a.exports.default}}(this,function(e,o){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.VXETablePluginMenus=void 0,o=(t=o)&&t.__esModule?t:{default:t};var n={CLEAR_CELL:function(e){var t=e.$table,a=e.row,n=e.column;a&&n&&t.clearData(a,n.property)},CLEAR_ROW:function(e){var t=e.$table,a=e.row;a&&t.clearData(a)},CLEAR_SELECTION_ROW:function(e){var t=e.$table;t.clearData(t.getSelectRecords())},CLEAR_ALL:function(e){e.$table.clearData()},REVERT_CELL:function(e){var t=e.$table,a=e.row,n=e.column;a&&n&&t.revertData(a,n.property)},REVERT_ROW:function(e){var t=e.$table,a=e.row;a&&t.revertData(a)},REVERT_SELECTION_ROW:function(e){var t=e.$table;t.revertData(t.getSelectRecords())},REVERT_ALL:function(e){e.$table.revertData()},INSERT_ROW:function(e){var t=e.$table,a=e.menu;t.insert(a.params)},INSERT_ACTIVED_ROW:function(e){var a=e.$table,t=e.menu,n=e.column,r=t.params||[];a.insert(r[0]).then(function(e){var t=e.row;return a.setActiveCell(t,r[1]||n.property)})},INSERT_AT_ROW:function(e){var t=e.$table,a=e.menu,n=e.row;n&&t.insertAt(a.params,n)},INSERT_AT_ACTIVED_ROW:function(e){var a=e.$table,t=e.menu,n=e.row,r=e.column;if(n){var o=t.params||[];a.insertAt(o[0],n).then(function(e){var t=e.row;return a.setActiveCell(t,o[1]||r.property)})}},DELETE_ROW:function(e){var t=e.$table,a=e.row;a&&t.remove(a)},DELETE_SELECTION_ROW:function(e){e.$table.removeSelecteds()},DELETE_ALL:function(e){e.$table.remove()},CLEAR_SORT:function(e){e.$table.clearSort()},SORT_ASC:function(e){var t=e.$table,a=e.column;a&&t.sort(a.property,"asc")},SORT_DESC:function(e){var t=e.$table,a=e.column;a&&t.sort(a.property,"desc")},CLEAR_FILTER:function(e){var t=e.$table,a=e.column;a&&t.clearFilter(a.property)},CLEAR_ALL_FILTER:function(e){e.$table.clearFilter()},FILTER_CELL:function(e){var t=e.$table,a=e.row,n=e.column;if(a&&n){var r=n.property;t.filter(r).then(function(e){if(e.length){var t=e[0];t.data=o.default.get(a,r),t.checked=!0}}).then(function(){return t.updateData()})}},EXPORT_ROW:function(e){var t=e.$table,a=e.menu,n=e.row;if(n){var r={data:[n]};t.exportCsv(a.params?o.default.assign(r,a.params[0]):r)}},EXPORT_SELECTION_ROW:function(e){var t=e.$table,a=e.menu,n={data:t.getSelectRecords()};t.exportCsv(a.params?o.default.assign(n,a.params[0]):n)},EXPORT_ALL:function(e){e.$table.exportCsv()},HIDDEN_COLUMN:function(e){var t=e.$table;e.column&&t.hideColumn()},RESET_COLUMN:function(e){e.$table.resetCustoms()},RESET_RESIZABLE:function(e){e.$table.resetResizable()},RESET_ALL:function(e){e.$table.resetAll()}};function a(e,t){var a=e.code,n=t.columns,r=t.column;switch(a){case"CLEAR_SORT":e.disabled=!n.some(function(e){return e.sortable&&e.order});break;case"CLEAR_ALL_FILTER":e.disabled=!n.some(function(e){return e.filters&&e.filters.some(function(e){return e.checked})});break;case"CLEAR_CELL":case"CLEAR_ROW":case"REVERT_CELL":case"REVERT_ROW":case"INSERT_AT_ROW":case"INSERT_AT_ACTIVED_ROW":case"DELETE_ROW":case"SORT_ASC":case"SORT_DESC":case"CLEAR_FILTER":case"FILTER_CELL":case"EXPORT_ROW":case"HIDDEN_COLUMN":if(e.disabled=!r,!e.disabled)switch(a){case"SORT_ASC":case"SORT_DESC":e.disabled=!r.sortable;break;case"FILTER_CELL":case"CLEAR_FILTER":if(e.disabled=!r.filters||!r.filters.length,!e.disabled)switch(a){case"CLEAR_FILTER":e.disabled=!r.filters.some(function(e){return e.checked})}}}}function r(t){t.options.forEach(function(e){e.forEach(function(e){a(e,t),e.children&&e.children.forEach(function(e){a(e,t)})})})}var c={install:function(e){var t=e.interceptor,a=e.menus;t.add("event.show_menu",r),a.mixin(n)}};e.VXETablePluginMenus=c,"undefined"!=typeof window&&window.VXETable&&window.VXETable.use(c);var i=c;e.default=i}); |
@@ -1,2 +0,2 @@ | ||
import XEUtils from 'xe-utils' | ||
import XEUtils from 'xe-utils/methods/xe-utils' | ||
@@ -131,4 +131,5 @@ const menuMap = { | ||
function checkPrivilege (item, { columns, column }) { | ||
function checkPrivilege (item, params) { | ||
let { code } = item | ||
let { columns, column } = params | ||
switch (code) { | ||
@@ -192,3 +193,4 @@ case 'CLEAR_SORT': | ||
export const VXETablePluginMenus = { | ||
install ({ menus, interceptor }) { | ||
install (VXETable) { | ||
let { interceptor, menus } = VXETable | ||
interceptor.add('event.show_menu', handlePrivilegeEvent) | ||
@@ -195,0 +197,0 @@ menus.mixin(menuMap) |
{ | ||
"name": "vxe-table-plugin-menus", | ||
"version": "1.0.1", | ||
"description": "vxe-table context menu plugins.", | ||
"version": "1.0.2", | ||
"description": "vxe-table context menu plugin.", | ||
"scripts": { | ||
@@ -40,3 +40,3 @@ "lib": "gulp build" | ||
"markdown-doctest": "^0.9.1", | ||
"xe-utils": "^2.0.10" | ||
"xe-utils": "^2.2.1" | ||
}, | ||
@@ -43,0 +43,0 @@ "peerDependencies": { |
@@ -8,3 +8,3 @@ # vxe-table-plugin-menus | ||
该插件用于在 [vxe-table](https://github.com/xuliangzhan/vxe-table) 表格中提供实用的快捷菜单集 | ||
基于 [vxe-table](https://github.com/xuliangzhan/vxe-table) 表格的增强插件,提供实用的快捷菜单集 | ||
@@ -30,3 +30,3 @@ ## Installing | ||
| code 编码 | 描述 | params 参数 | | ||
| code 编码 | describe 描述 | params 参数 | | ||
|------|------|------| | ||
@@ -66,3 +66,3 @@ | CLEAR_CELL | 清除单元格数据的值 | — | | ||
border | ||
:data.sync="tableData" | ||
:data="tableData" | ||
:context-menu="{body: {options: bodyMenus}}" | ||
@@ -69,0 +69,0 @@ :edit-config="{trigger: 'click', mode: 'cell'}"> |
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
32443
767