mali-ui-plus 1.0.154 → 1.0.155

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.
@@ -74958,13 +74958,162 @@ const MaliClipboard = {
74958
74958
  };
74959
74959
  /* harmony default export */ var clipboard = (MaliClipboard);
74960
74960
  ;// CONCATENATED MODULE: ./export/xlsx.ts
74961
- // import XEUtils from 'xe-utils'
74961
+
74962
+
74963
+
74964
+
74965
+
74966
+
74962
74967
  const MaliXlsx = {
74968
+ readFile(options) {
74969
+ const opts = Object.assign({
74970
+ multiple: false
74971
+ }, options);
74972
+ return VXETable.readFile({
74973
+ types: ['xlsx'],
74974
+ multiple: opts.multiple
74975
+ });
74976
+ },
74963
74977
  exportData(options) {
74964
- const opts = Object.assign({}, options);
74965
- if (opts) {
74966
- //
74978
+ const opts = Object.assign({
74979
+ fileName: '',
74980
+ showHeader: true,
74981
+ columns: [],
74982
+ data: []
74983
+ }, options);
74984
+ const workbook = new (exceljs_min_default()).Workbook();
74985
+ const sheet = workbook.addWorksheet(opts.sheetName || '表1');
74986
+ workbook.creator = 'mali-ui';
74987
+ const headItem = {};
74988
+ const shettCols = [];
74989
+ opts.columns.forEach((item, cIndex) => {
74990
+ headItem[cIndex] = item.title || `列${cIndex + 1}`;
74991
+ shettCols.push({
74992
+ key: `${cIndex}`,
74993
+ width: item.width ? xe_utils_default().ceil(item.width / 8, 1) : 20
74994
+ });
74995
+ });
74996
+ sheet.columns = shettCols;
74997
+ const defaultHeaderBackgroundColor = 'c5d9f1';
74998
+ const defaultBackgroundColor = 'f8f8f9';
74999
+ const defaultCellFontColor = '606266';
75000
+ const defaultCellBorderStyle = 'thin';
75001
+ const defaultCellBorderColor = '666666';
75002
+ if (opts.showHeader) {
75003
+ const headList = [headItem];
75004
+ sheet.addRows(headList).forEach(excelRow => {
75005
+ excelRow.eachCell(excelCell => {
75006
+ Object.assign(excelCell, {
75007
+ font: {
75008
+ bold: true,
75009
+ color: {
75010
+ argb: defaultCellFontColor
75011
+ }
75012
+ },
75013
+ fill: {
75014
+ type: 'pattern',
75015
+ pattern: 'solid',
75016
+ fgColor: {
75017
+ argb: defaultHeaderBackgroundColor
75018
+ }
75019
+ },
75020
+ protection: {
75021
+ locked: false
75022
+ },
75023
+ alignment: {
75024
+ vertical: 'middle',
75025
+ horizontal: 'center'
75026
+ },
75027
+ border: {
75028
+ top: {
75029
+ style: defaultCellBorderStyle,
75030
+ color: {
75031
+ argb: defaultCellBorderColor
75032
+ }
75033
+ },
75034
+ left: {
75035
+ style: defaultCellBorderStyle,
75036
+ color: {
75037
+ argb: defaultCellBorderColor
75038
+ }
75039
+ },
75040
+ bottom: {
75041
+ style: defaultCellBorderStyle,
75042
+ color: {
75043
+ argb: defaultCellBorderColor
75044
+ }
75045
+ },
75046
+ right: {
75047
+ style: defaultCellBorderStyle,
75048
+ color: {
75049
+ argb: defaultCellBorderColor
75050
+ }
75051
+ }
75052
+ }
75053
+ });
75054
+ });
75055
+ });
74967
75056
  }
75057
+ const rowList = [];
75058
+ opts.data.forEach(row => {
75059
+ const item = {};
75060
+ opts.columns.forEach((col, cIndex) => {
75061
+ item[cIndex] = row[col.field];
75062
+ });
75063
+ rowList.push(item);
75064
+ });
75065
+ sheet.addRows(rowList).forEach(excelRow => {
75066
+ excelRow.eachCell(excelCell => {
75067
+ Object.assign(excelCell, {
75068
+ font: {
75069
+ bold: true,
75070
+ color: {
75071
+ argb: defaultCellFontColor
75072
+ }
75073
+ },
75074
+ fill: {
75075
+ type: 'pattern',
75076
+ pattern: 'solid',
75077
+ fgColor: {
75078
+ argb: defaultBackgroundColor
75079
+ }
75080
+ },
75081
+ border: {
75082
+ top: {
75083
+ style: defaultCellBorderStyle,
75084
+ color: {
75085
+ argb: defaultCellBorderColor
75086
+ }
75087
+ },
75088
+ left: {
75089
+ style: defaultCellBorderStyle,
75090
+ color: {
75091
+ argb: defaultCellBorderColor
75092
+ }
75093
+ },
75094
+ bottom: {
75095
+ style: defaultCellBorderStyle,
75096
+ color: {
75097
+ argb: defaultCellBorderColor
75098
+ }
75099
+ },
75100
+ right: {
75101
+ style: defaultCellBorderStyle,
75102
+ color: {
75103
+ argb: defaultCellBorderColor
75104
+ }
75105
+ }
75106
+ }
75107
+ });
75108
+ });
75109
+ });
75110
+ workbook.xlsx.writeBuffer().then(buffer => {
75111
+ const blob = new Blob([buffer], {
75112
+ type: 'application/octet-stream'
75113
+ });
75114
+ utils.saveFileByBlob(blob, `${opts.fileName || Date.now()}.xlsx`);
75115
+ toast.success('导出成功');
75116
+ });
74968
75117
  }
74969
75118
  };
74970
75119
  /* harmony default export */ var xlsx = (MaliXlsx);
@@ -76916,7 +77065,7 @@ function index_config(options) {
76916
77065
  return config_0;
76917
77066
  }
76918
77067
  const MaliUI = {
76919
- version: "1.0.153",
77068
+ version: "1.0.154",
76920
77069
  install: index_install,
76921
77070
  config: index_config,
76922
77071
  renderer: {
@@ -74968,13 +74968,162 @@ const MaliClipboard = {
74968
74968
  };
74969
74969
  /* harmony default export */ var clipboard = (MaliClipboard);
74970
74970
  ;// CONCATENATED MODULE: ./export/xlsx.ts
74971
- // import XEUtils from 'xe-utils'
74971
+
74972
+
74973
+
74974
+
74975
+
74976
+
74972
74977
  const MaliXlsx = {
74978
+ readFile(options) {
74979
+ const opts = Object.assign({
74980
+ multiple: false
74981
+ }, options);
74982
+ return VXETable.readFile({
74983
+ types: ['xlsx'],
74984
+ multiple: opts.multiple
74985
+ });
74986
+ },
74973
74987
  exportData(options) {
74974
- const opts = Object.assign({}, options);
74975
- if (opts) {
74976
- //
74988
+ const opts = Object.assign({
74989
+ fileName: '',
74990
+ showHeader: true,
74991
+ columns: [],
74992
+ data: []
74993
+ }, options);
74994
+ const workbook = new (exceljs_min_default()).Workbook();
74995
+ const sheet = workbook.addWorksheet(opts.sheetName || '表1');
74996
+ workbook.creator = 'mali-ui';
74997
+ const headItem = {};
74998
+ const shettCols = [];
74999
+ opts.columns.forEach((item, cIndex) => {
75000
+ headItem[cIndex] = item.title || `列${cIndex + 1}`;
75001
+ shettCols.push({
75002
+ key: `${cIndex}`,
75003
+ width: item.width ? xe_utils_default().ceil(item.width / 8, 1) : 20
75004
+ });
75005
+ });
75006
+ sheet.columns = shettCols;
75007
+ const defaultHeaderBackgroundColor = 'c5d9f1';
75008
+ const defaultBackgroundColor = 'f8f8f9';
75009
+ const defaultCellFontColor = '606266';
75010
+ const defaultCellBorderStyle = 'thin';
75011
+ const defaultCellBorderColor = '666666';
75012
+ if (opts.showHeader) {
75013
+ const headList = [headItem];
75014
+ sheet.addRows(headList).forEach(excelRow => {
75015
+ excelRow.eachCell(excelCell => {
75016
+ Object.assign(excelCell, {
75017
+ font: {
75018
+ bold: true,
75019
+ color: {
75020
+ argb: defaultCellFontColor
75021
+ }
75022
+ },
75023
+ fill: {
75024
+ type: 'pattern',
75025
+ pattern: 'solid',
75026
+ fgColor: {
75027
+ argb: defaultHeaderBackgroundColor
75028
+ }
75029
+ },
75030
+ protection: {
75031
+ locked: false
75032
+ },
75033
+ alignment: {
75034
+ vertical: 'middle',
75035
+ horizontal: 'center'
75036
+ },
75037
+ border: {
75038
+ top: {
75039
+ style: defaultCellBorderStyle,
75040
+ color: {
75041
+ argb: defaultCellBorderColor
75042
+ }
75043
+ },
75044
+ left: {
75045
+ style: defaultCellBorderStyle,
75046
+ color: {
75047
+ argb: defaultCellBorderColor
75048
+ }
75049
+ },
75050
+ bottom: {
75051
+ style: defaultCellBorderStyle,
75052
+ color: {
75053
+ argb: defaultCellBorderColor
75054
+ }
75055
+ },
75056
+ right: {
75057
+ style: defaultCellBorderStyle,
75058
+ color: {
75059
+ argb: defaultCellBorderColor
75060
+ }
75061
+ }
75062
+ }
75063
+ });
75064
+ });
75065
+ });
74977
75066
  }
75067
+ const rowList = [];
75068
+ opts.data.forEach(row => {
75069
+ const item = {};
75070
+ opts.columns.forEach((col, cIndex) => {
75071
+ item[cIndex] = row[col.field];
75072
+ });
75073
+ rowList.push(item);
75074
+ });
75075
+ sheet.addRows(rowList).forEach(excelRow => {
75076
+ excelRow.eachCell(excelCell => {
75077
+ Object.assign(excelCell, {
75078
+ font: {
75079
+ bold: true,
75080
+ color: {
75081
+ argb: defaultCellFontColor
75082
+ }
75083
+ },
75084
+ fill: {
75085
+ type: 'pattern',
75086
+ pattern: 'solid',
75087
+ fgColor: {
75088
+ argb: defaultBackgroundColor
75089
+ }
75090
+ },
75091
+ border: {
75092
+ top: {
75093
+ style: defaultCellBorderStyle,
75094
+ color: {
75095
+ argb: defaultCellBorderColor
75096
+ }
75097
+ },
75098
+ left: {
75099
+ style: defaultCellBorderStyle,
75100
+ color: {
75101
+ argb: defaultCellBorderColor
75102
+ }
75103
+ },
75104
+ bottom: {
75105
+ style: defaultCellBorderStyle,
75106
+ color: {
75107
+ argb: defaultCellBorderColor
75108
+ }
75109
+ },
75110
+ right: {
75111
+ style: defaultCellBorderStyle,
75112
+ color: {
75113
+ argb: defaultCellBorderColor
75114
+ }
75115
+ }
75116
+ }
75117
+ });
75118
+ });
75119
+ });
75120
+ workbook.xlsx.writeBuffer().then(buffer => {
75121
+ const blob = new Blob([buffer], {
75122
+ type: 'application/octet-stream'
75123
+ });
75124
+ utils.saveFileByBlob(blob, `${opts.fileName || Date.now()}.xlsx`);
75125
+ toast.success('导出成功');
75126
+ });
74978
75127
  }
74979
75128
  };
74980
75129
  /* harmony default export */ var xlsx = (MaliXlsx);
@@ -76926,7 +77075,7 @@ function index_config(options) {
76926
77075
  return config_0;
76927
77076
  }
76928
77077
  const MaliUI = {
76929
- version: "1.0.153",
77078
+ version: "1.0.154",
76930
77079
  install: index_install,
76931
77080
  config: index_config,
76932
77081
  renderer: {