vxe-table 4.7.0-alpha.4 → 4.7.0-alpha.7

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,6 +1,6 @@
1
1
  import { inject, nextTick } from 'vue';
2
2
  import XEUtils from 'xe-utils';
3
- import { VxeUI, getConfig, getI18n, hooks, renderer, log } from '@vxe-ui/core';
3
+ import { VxeUI, getI18n, hooks, renderer, log } from '@vxe-ui/core';
4
4
  import { isColumnInfo, mergeBodyMethod, getCellValue } from '../../src/util';
5
5
  import { parseFile, formatText } from '../../../ui/src/utils';
6
6
  import { createHtmlPage, getExportBlobByContent } from './util';
@@ -807,8 +807,9 @@ hooks.add('tableExportModule', {
807
807
  const handleFileImport = (file, opts) => {
808
808
  const { importMethod, afterImportMethod } = opts;
809
809
  const { type, filename } = parseFile(file);
810
+ const importOpts = computeImportOpts.value;
810
811
  // 检查类型,如果为自定义导出,则不需要校验类型
811
- if (!importMethod && !XEUtils.includes(getConfig().importTypes, type)) {
812
+ if (!importMethod && !XEUtils.includes(XEUtils.keys(importOpts._typeMaps), type)) {
812
813
  if (opts.message !== false) {
813
814
  if (VxeUI.modal) {
814
815
  VxeUI.modal.message({ content: getI18n('vxe.error.notType', [type]), status: 'error' });
@@ -882,13 +883,14 @@ hooks.add('tableExportModule', {
882
883
  const { treeConfig, showHeader, showFooter } = props;
883
884
  const { initStore, mergeList, isGroup, footerTableData, exportStore, exportParams } = reactData;
884
885
  const { collectColumn } = internalData;
886
+ const exportOpts = computeExportOpts.value;
885
887
  const hasTree = treeConfig;
886
888
  const customOpts = computeCustomOpts.value;
887
889
  const selectRecords = $xeTable.getCheckboxRecords();
888
890
  const hasFooter = !!footerTableData.length;
889
891
  const hasMerge = !hasTree && mergeList.length;
890
892
  const defOpts = Object.assign({ message: true, isHeader: showHeader, isFooter: showFooter }, options);
891
- const types = defOpts.types || getConfig().exportTypes;
893
+ const types = defOpts.types || XEUtils.keys(exportOpts._typeMaps);
892
894
  const modes = defOpts.modes;
893
895
  const checkMethod = customOpts.checkMethod;
894
896
  const exportColumns = collectColumn.slice(0);
@@ -1072,7 +1074,7 @@ hooks.add('tableExportModule', {
1072
1074
  opts.sheetName = document.title;
1073
1075
  }
1074
1076
  // 检查类型,如果为自定义导出,则不需要校验类型
1075
- if (!opts.exportMethod && !XEUtils.includes(getConfig().exportTypes, type)) {
1077
+ if (!opts.exportMethod && !XEUtils.includes(XEUtils.keys(exportOpts._typeMaps), type)) {
1076
1078
  if (process.env.NODE_ENV === 'development') {
1077
1079
  log.err('vxe.error.notType', [type]);
1078
1080
  }
@@ -1148,7 +1150,7 @@ hooks.add('tableExportModule', {
1148
1150
  importData(options) {
1149
1151
  const importOpts = computeImportOpts.value;
1150
1152
  const opts = Object.assign({
1151
- types: getConfig().importTypes
1153
+ types: XEUtils.keys(importOpts._typeMaps)
1152
1154
  // beforeImportMethod: null,
1153
1155
  // afterImportMethod: null
1154
1156
  }, importOpts, options);
@@ -1211,7 +1213,7 @@ hooks.add('tableExportModule', {
1211
1213
  const { treeConfig, importConfig } = props;
1212
1214
  const { initStore, importStore, importParams } = reactData;
1213
1215
  const importOpts = computeImportOpts.value;
1214
- const defOpts = Object.assign({ mode: 'insert', message: true, types: getConfig().importTypes }, options, importOpts);
1216
+ const defOpts = Object.assign({ mode: 'insert', message: true, types: XEUtils.keys(importOpts._typeMaps) }, options, importOpts);
1215
1217
  const { types } = defOpts;
1216
1218
  const isTree = !!treeConfig;
1217
1219
  if (isTree) {
@@ -6607,11 +6607,11 @@ export default defineComponent({
6607
6607
  const { exportConfig, importConfig } = props;
6608
6608
  const exportOpts = computeExportOpts.value;
6609
6609
  const importOpts = computeImportOpts.value;
6610
- if (importConfig && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(getConfig().importTypes, importOpts.types)) {
6611
- log.warn('vxe.error.errProp', [`export-config.types=${importOpts.types.join(',')}`, importOpts.types.filter((type) => XEUtils.includes(getConfig().importTypes, type)).join(',') || getConfig().importTypes.join(',')]);
6610
+ if (importConfig && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(XEUtils.keys(importOpts._typeMaps), importOpts.types)) {
6611
+ log.warn('vxe.error.errProp', [`export-config.types=${importOpts.types.join(',')}`, importOpts.types.filter((type) => XEUtils.includes(XEUtils.keys(importOpts._typeMaps), type)).join(',') || XEUtils.keys(importOpts._typeMaps).join(',')]);
6612
6612
  }
6613
- if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(getConfig().exportTypes, exportOpts.types)) {
6614
- log.warn('vxe.error.errProp', [`export-config.types=${exportOpts.types.join(',')}`, exportOpts.types.filter((type) => XEUtils.includes(getConfig().exportTypes, type)).join(',') || getConfig().exportTypes.join(',')]);
6613
+ if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(XEUtils.keys(exportOpts._typeMaps), exportOpts.types)) {
6614
+ log.warn('vxe.error.errProp', [`export-config.types=${exportOpts.types.join(',')}`, exportOpts.types.filter((type) => XEUtils.includes(XEUtils.keys(exportOpts._typeMaps), type)).join(',') || XEUtils.keys(exportOpts._typeMaps).join(',')]);
6615
6615
  }
6616
6616
  }
6617
6617
  if (process.env.NODE_ENV === 'development') {
package/es/ui/index.js CHANGED
@@ -1,9 +1,7 @@
1
- import { VxeUI, setConfig, setIcon } from '@vxe-ui/core';
1
+ import { VxeUI, setConfig, setIcon, log } from '@vxe-ui/core';
2
2
  VxeUI.tableVersion = process.env.VUE_APP_VXE_TABLE_VERSION;
3
3
  setConfig({
4
4
  emptyCell: ' ',
5
- exportTypes: [],
6
- importTypes: [],
7
5
  table: {
8
6
  fit: true,
9
7
  showHeader: true,
@@ -93,9 +91,16 @@ setConfig({
93
91
  showAsterisk: true
94
92
  },
95
93
  importConfig: {
94
+ _typeMaps: {},
96
95
  modes: ['insert', 'covering']
97
96
  },
98
97
  exportConfig: {
98
+ _typeMaps: {
99
+ csv: 1,
100
+ html: 1,
101
+ xml: 1,
102
+ txt: 1
103
+ },
99
104
  modes: ['current', 'selected']
100
105
  },
101
106
  printConfig: {
@@ -216,5 +221,15 @@ setIcon({
216
221
  TOOLBAR_TOOLS_FIXED_RIGHT: iconPrefix + 'fixed-right',
217
222
  TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE: iconPrefix + 'fixed-right-fill'
218
223
  });
224
+ export function config(options) {
225
+ log.warn('vxe.error.delFunc', ['config', 'setConfig']);
226
+ return setConfig(options);
227
+ }
228
+ export function setup(options) {
229
+ log.warn('vxe.error.delFunc', ['setup', 'setConfig']);
230
+ return setConfig(options);
231
+ }
232
+ // 兼容老版本
233
+ export const VXETable = VxeUI;
219
234
  export * from '@vxe-ui/core';
220
235
  export default VxeUI;
package/lib/index.umd.js CHANGED
@@ -12584,11 +12584,11 @@ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT';
12584
12584
  } = props;
12585
12585
  const exportOpts = computeExportOpts.value;
12586
12586
  const importOpts = computeImportOpts.value;
12587
- if (importConfig && importOpts.types && !importOpts.importMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includeArrays((0,core_.getConfig)().importTypes, importOpts.types)) {
12588
- core_.log.warn('vxe.error.errProp', [`export-config.types=${importOpts.types.join(',')}`, importOpts.types.filter(type => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes((0,core_.getConfig)().importTypes, type)).join(',') || (0,core_.getConfig)().importTypes.join(',')]);
12587
+ if (importConfig && importOpts.types && !importOpts.importMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includeArrays(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps), importOpts.types)) {
12588
+ core_.log.warn('vxe.error.errProp', [`export-config.types=${importOpts.types.join(',')}`, importOpts.types.filter(type => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps), type)).join(',') || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps).join(',')]);
12589
12589
  }
12590
- if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includeArrays((0,core_.getConfig)().exportTypes, exportOpts.types)) {
12591
- core_.log.warn('vxe.error.errProp', [`export-config.types=${exportOpts.types.join(',')}`, exportOpts.types.filter(type => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes((0,core_.getConfig)().exportTypes, type)).join(',') || (0,core_.getConfig)().exportTypes.join(',')]);
12590
+ if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includeArrays(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps), exportOpts.types)) {
12591
+ core_.log.warn('vxe.error.errProp', [`export-config.types=${exportOpts.types.join(',')}`, exportOpts.types.filter(type => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps), type)).join(',') || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps).join(',')]);
12592
12592
  }
12593
12593
  }
12594
12594
  if (true) {
@@ -15735,8 +15735,9 @@ core_.hooks.add('tableExportModule', {
15735
15735
  type,
15736
15736
  filename
15737
15737
  } = (0,utils/* parseFile */.CJ)(file);
15738
+ const importOpts = computeImportOpts.value;
15738
15739
  // 检查类型,如果为自定义导出,则不需要校验类型
15739
- if (!importMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes((0,core_.getConfig)().importTypes, type)) {
15740
+ if (!importMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps), type)) {
15740
15741
  if (opts.message !== false) {
15741
15742
  if (core_.VxeUI.modal) {
15742
15743
  core_.VxeUI.modal.message({
@@ -15858,6 +15859,7 @@ core_.hooks.add('tableExportModule', {
15858
15859
  const {
15859
15860
  collectColumn
15860
15861
  } = internalData;
15862
+ const exportOpts = computeExportOpts.value;
15861
15863
  const hasTree = treeConfig;
15862
15864
  const customOpts = computeCustomOpts.value;
15863
15865
  const selectRecords = $xeTable.getCheckboxRecords();
@@ -15868,7 +15870,7 @@ core_.hooks.add('tableExportModule', {
15868
15870
  isHeader: showHeader,
15869
15871
  isFooter: showFooter
15870
15872
  }, options);
15871
- const types = defOpts.types || (0,core_.getConfig)().exportTypes;
15873
+ const types = defOpts.types || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps);
15872
15874
  const modes = defOpts.modes;
15873
15875
  const checkMethod = customOpts.checkMethod;
15874
15876
  const exportColumns = collectColumn.slice(0);
@@ -16073,7 +16075,7 @@ core_.hooks.add('tableExportModule', {
16073
16075
  opts.sheetName = document.title;
16074
16076
  }
16075
16077
  // 检查类型,如果为自定义导出,则不需要校验类型
16076
- if (!opts.exportMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes((0,core_.getConfig)().exportTypes, type)) {
16078
+ if (!opts.exportMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps), type)) {
16077
16079
  if (true) {
16078
16080
  core_.log.err('vxe.error.notType', [type]);
16079
16081
  }
@@ -16167,7 +16169,7 @@ core_.hooks.add('tableExportModule', {
16167
16169
  importData(options) {
16168
16170
  const importOpts = computeImportOpts.value;
16169
16171
  const opts = Object.assign({
16170
- types: (0,core_.getConfig)().importTypes
16172
+ types: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps)
16171
16173
  // beforeImportMethod: null,
16172
16174
  // afterImportMethod: null
16173
16175
  }, importOpts, options);
@@ -16254,7 +16256,7 @@ core_.hooks.add('tableExportModule', {
16254
16256
  const defOpts = Object.assign({
16255
16257
  mode: 'insert',
16256
16258
  message: true,
16257
- types: (0,core_.getConfig)().importTypes
16259
+ types: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(importOpts._typeMaps)
16258
16260
  }, options, importOpts);
16259
16261
  const {
16260
16262
  types
@@ -21055,17 +21057,20 @@ const Toolbar = VxeToolbar;
21055
21057
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
21056
21058
 
21057
21059
  __webpack_require__.r(__webpack_exports__);
21060
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21061
+ /* harmony export */ VXETable: function() { return /* binding */ VXETable; },
21062
+ /* harmony export */ config: function() { return /* binding */ config; },
21063
+ /* harmony export */ setup: function() { return /* binding */ setup; }
21064
+ /* harmony export */ });
21058
21065
  /* harmony import */ var _vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8514);
21059
21066
  /* harmony import */ var _vxe_ui_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__);
21060
21067
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
21061
- /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = function(key) { return _vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
21068
+ /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__) if(["default","config","setup","VXETable"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = function(key) { return _vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
21062
21069
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
21063
21070
 
21064
- _vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__.VxeUI.tableVersion = ({"NODE_ENV":"production","VUE_APP_VXE_ENV":"development","VUE_APP_VXE_VERSION":"4.7.0-alpha.4","BASE_URL":"/"}).VUE_APP_VXE_TABLE_VERSION;
21071
+ _vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__.VxeUI.tableVersion = ({"NODE_ENV":"production","VUE_APP_VXE_ENV":"development","VUE_APP_VXE_VERSION":"4.7.0-alpha.6","BASE_URL":"/"}).VUE_APP_VXE_TABLE_VERSION;
21065
21072
  (0,_vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__.setConfig)({
21066
21073
  emptyCell: ' ',
21067
- exportTypes: [],
21068
- importTypes: [],
21069
21074
  table: {
21070
21075
  fit: true,
21071
21076
  showHeader: true,
@@ -21155,9 +21160,16 @@ _vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__.VxeUI.tableVersion = ({"NODE_ENV":"pro
21155
21160
  showAsterisk: true
21156
21161
  },
21157
21162
  importConfig: {
21163
+ _typeMaps: {},
21158
21164
  modes: ['insert', 'covering']
21159
21165
  },
21160
21166
  exportConfig: {
21167
+ _typeMaps: {
21168
+ csv: 1,
21169
+ html: 1,
21170
+ xml: 1,
21171
+ txt: 1
21172
+ },
21161
21173
  modes: ['current', 'selected']
21162
21174
  },
21163
21175
  printConfig: {
@@ -21278,6 +21290,16 @@ const iconPrefix = 'vxe-icon-';
21278
21290
  TOOLBAR_TOOLS_FIXED_RIGHT: iconPrefix + 'fixed-right',
21279
21291
  TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE: iconPrefix + 'fixed-right-fill'
21280
21292
  });
21293
+ function config(options) {
21294
+ _vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__.log.warn('vxe.error.delFunc', ['config', 'setConfig']);
21295
+ return (0,_vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__.setConfig)(options);
21296
+ }
21297
+ function setup(options) {
21298
+ _vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__.log.warn('vxe.error.delFunc', ['setup', 'setConfig']);
21299
+ return (0,_vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__.setConfig)(options);
21300
+ }
21301
+ // 兼容老版本
21302
+ const VXETable = _vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__.VxeUI;
21281
21303
 
21282
21304
  /* harmony default export */ __webpack_exports__["default"] = (_vxe_ui_core__WEBPACK_IMPORTED_MODULE_0__.VxeUI);
21283
21305