ele-admin-plus 1.4.1-beta.1 → 1.4.1

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.
Files changed (224) hide show
  1. package/es/core-components.d.ts +2 -0
  2. package/es/core-components.js +104 -100
  3. package/es/ele-app/plus.d.ts +9 -1
  4. package/es/ele-app/plusx.d.ts +26 -13
  5. package/es/ele-backtop/index.js +7 -1
  6. package/es/ele-basic-select/components/select-view.d.ts +53 -22
  7. package/es/ele-basic-select/components/select-view.js +57 -20
  8. package/es/ele-basic-select/index.d.ts +39 -19
  9. package/es/ele-basic-select/index.js +62 -13
  10. package/es/ele-basic-select/props.d.ts +33 -21
  11. package/es/ele-basic-select/props.js +33 -21
  12. package/es/ele-basic-select/style/index.js +2 -0
  13. package/es/ele-basic-select/types.d.ts +1 -1
  14. package/es/ele-config-provider/components/receiver-view.d.ts +2 -0
  15. package/es/ele-config-provider/components/receiver-view.js +74 -72
  16. package/es/ele-config-provider/receiver.d.ts +2 -2
  17. package/es/ele-config-provider/receiver.js +5 -1
  18. package/es/ele-config-provider/types.d.ts +10 -1
  19. package/es/ele-copyable/index.d.ts +2 -4
  20. package/es/ele-cron-builder/index.d.ts +24 -0
  21. package/es/ele-cron-builder/index.js +81 -0
  22. package/es/ele-cron-builder/props.d.ts +31 -0
  23. package/es/ele-cron-builder/props.js +24 -0
  24. package/es/ele-cron-builder/style/index.d.ts +1 -0
  25. package/es/ele-cron-builder/style/index.js +4 -0
  26. package/es/ele-cron-builder/style/index.scss +6 -0
  27. package/es/ele-cron-builder/types.d.ts +8 -0
  28. package/es/ele-cron-panel/components/cron-day.d.ts +25 -0
  29. package/es/ele-cron-panel/components/cron-day.js +232 -0
  30. package/es/ele-cron-panel/components/cron-hour.d.ts +25 -0
  31. package/es/ele-cron-panel/components/cron-hour.js +174 -0
  32. package/es/ele-cron-panel/components/cron-minute.d.ts +25 -0
  33. package/es/ele-cron-panel/components/cron-minute.js +174 -0
  34. package/es/ele-cron-panel/components/cron-month.d.ts +25 -0
  35. package/es/ele-cron-panel/components/cron-month.js +174 -0
  36. package/es/ele-cron-panel/components/cron-second.d.ts +25 -0
  37. package/es/ele-cron-panel/components/cron-second.js +174 -0
  38. package/es/ele-cron-panel/components/cron-week.d.ts +25 -0
  39. package/es/ele-cron-panel/components/cron-week.js +229 -0
  40. package/es/ele-cron-panel/components/cron-year.d.ts +25 -0
  41. package/es/ele-cron-panel/components/cron-year.js +186 -0
  42. package/es/ele-cron-panel/index.d.ts +14 -0
  43. package/es/ele-cron-panel/index.js +348 -0
  44. package/es/ele-cron-panel/props.d.ts +20 -0
  45. package/es/ele-cron-panel/props.js +14 -0
  46. package/es/ele-cron-panel/style/index.d.ts +1 -0
  47. package/es/ele-cron-panel/style/index.js +7 -0
  48. package/es/ele-cron-panel/style/index.scss +282 -0
  49. package/es/ele-cron-panel/types.d.ts +118 -0
  50. package/es/ele-cron-panel/util.d.ts +23 -0
  51. package/es/ele-cron-panel/util.js +542 -0
  52. package/es/ele-cropper/components/cropper-tools.d.ts +2 -2
  53. package/es/ele-cropper-modal/index.d.ts +2 -4
  54. package/es/ele-crud/index.d.ts +3 -3
  55. package/es/ele-drawer/index.d.ts +9 -0
  56. package/es/ele-drawer/index.js +5 -1
  57. package/es/ele-drawer/props.d.ts +5 -0
  58. package/es/ele-drawer/props.js +6 -1
  59. package/es/ele-drawer/style/index.scss +11 -0
  60. package/es/ele-file-list/index.d.ts +3 -3
  61. package/es/ele-icon-select/components/icon-grid.d.ts +8 -3
  62. package/es/ele-icon-select/components/icon-grid.js +20 -12
  63. package/es/ele-icon-select/index.d.ts +58 -59
  64. package/es/ele-icon-select/index.js +92 -86
  65. package/es/ele-icon-select/props.d.ts +35 -35
  66. package/es/ele-icon-select/props.js +34 -34
  67. package/es/ele-icon-select/style/css-var.scss +1 -1
  68. package/es/ele-icon-select/style/index.scss +50 -18
  69. package/es/ele-icon-select/types.d.ts +13 -0
  70. package/es/ele-map-picker/index.d.ts +3 -3
  71. package/es/ele-modal/index.d.ts +4 -2
  72. package/es/ele-modal/index.js +9 -3
  73. package/es/ele-modal/props.d.ts +2 -0
  74. package/es/ele-modal/props.js +2 -0
  75. package/es/ele-modal/style/index.scss +16 -0
  76. package/es/ele-pro-form/components/item-type-data.js +39 -64
  77. package/es/ele-pro-form/index.d.ts +3 -3
  78. package/es/ele-pro-table/components/table-tools.d.ts +12 -97
  79. package/es/ele-pro-table/components/table-tools.js +118 -248
  80. package/es/ele-pro-table/components/tool-export.d.ts +5 -1
  81. package/es/ele-pro-table/components/tool-export.js +32 -20
  82. package/es/ele-pro-table/components/tool-print.d.ts +5 -1
  83. package/es/ele-pro-table/components/tool-print.js +37 -25
  84. package/es/ele-pro-table/exceljs-plugin.d.ts +12 -0
  85. package/es/ele-pro-table/exceljs-plugin.js +81 -0
  86. package/es/ele-pro-table/index.d.ts +6 -7
  87. package/es/ele-pro-table/index.js +117 -46
  88. package/es/ele-pro-table/types.d.ts +11 -0
  89. package/es/ele-split-panel/style/index.scss +1 -1
  90. package/es/ele-table-select/index.d.ts +2 -0
  91. package/es/ele-table-select/props.d.ts +2 -0
  92. package/es/ele-table-select/props.js +3 -1
  93. package/es/ele-tour/index.d.ts +3 -3
  94. package/es/ele-tree-select/index.d.ts +2 -0
  95. package/es/ele-upload-list/index.d.ts +3 -3
  96. package/es/ele-upload-list/index.js +25 -8
  97. package/es/ele-virtual-table/components/body-cell.d.ts +1 -1
  98. package/es/ele-watermark/index.d.ts +20 -7
  99. package/es/ele-watermark/index.js +253 -94
  100. package/es/ele-watermark/props.d.ts +10 -3
  101. package/es/ele-watermark/props.js +10 -3
  102. package/es/ele-watermark/types.d.ts +12 -0
  103. package/es/ele-watermark/util.d.ts +2 -9
  104. package/es/ele-watermark/util.js +10 -19
  105. package/es/lang/en_US.js +116 -0
  106. package/es/lang/zh_CN.js +116 -0
  107. package/es/lang/zh_TW.js +116 -0
  108. package/es/style/plus.scss +3 -1
  109. package/es/style/themes/default.scss +12 -3
  110. package/es/style/themes/rounded.scss +2 -1
  111. package/es/utils/theme-util.d.ts +1 -1
  112. package/lib/core-components.cjs +104 -100
  113. package/lib/core-components.d.ts +2 -0
  114. package/lib/ele-app/plus.d.ts +9 -1
  115. package/lib/ele-app/plusx.d.ts +26 -13
  116. package/lib/ele-backtop/index.cjs +6 -0
  117. package/lib/ele-basic-select/components/select-view.cjs +56 -19
  118. package/lib/ele-basic-select/components/select-view.d.ts +53 -22
  119. package/lib/ele-basic-select/index.cjs +61 -12
  120. package/lib/ele-basic-select/index.d.ts +39 -19
  121. package/lib/ele-basic-select/props.cjs +33 -21
  122. package/lib/ele-basic-select/props.d.ts +33 -21
  123. package/lib/ele-basic-select/style/index.cjs +2 -0
  124. package/lib/ele-basic-select/types.d.ts +1 -1
  125. package/lib/ele-config-provider/components/receiver-view.cjs +2 -2
  126. package/lib/ele-config-provider/components/receiver-view.d.ts +2 -0
  127. package/lib/ele-config-provider/receiver.cjs +5 -1
  128. package/lib/ele-config-provider/receiver.d.ts +2 -2
  129. package/lib/ele-config-provider/types.d.ts +10 -1
  130. package/lib/ele-copyable/index.d.ts +2 -4
  131. package/lib/ele-cron-builder/index.cjs +80 -0
  132. package/lib/ele-cron-builder/index.d.ts +24 -0
  133. package/lib/ele-cron-builder/props.cjs +24 -0
  134. package/lib/ele-cron-builder/props.d.ts +31 -0
  135. package/lib/ele-cron-builder/style/index.cjs +5 -0
  136. package/lib/ele-cron-builder/style/index.d.ts +1 -0
  137. package/lib/ele-cron-builder/style/index.scss +6 -0
  138. package/lib/ele-cron-builder/types.d.ts +8 -0
  139. package/lib/ele-cron-panel/components/cron-day.cjs +231 -0
  140. package/lib/ele-cron-panel/components/cron-day.d.ts +25 -0
  141. package/lib/ele-cron-panel/components/cron-hour.cjs +173 -0
  142. package/lib/ele-cron-panel/components/cron-hour.d.ts +25 -0
  143. package/lib/ele-cron-panel/components/cron-minute.cjs +173 -0
  144. package/lib/ele-cron-panel/components/cron-minute.d.ts +25 -0
  145. package/lib/ele-cron-panel/components/cron-month.cjs +173 -0
  146. package/lib/ele-cron-panel/components/cron-month.d.ts +25 -0
  147. package/lib/ele-cron-panel/components/cron-second.cjs +173 -0
  148. package/lib/ele-cron-panel/components/cron-second.d.ts +25 -0
  149. package/lib/ele-cron-panel/components/cron-week.cjs +228 -0
  150. package/lib/ele-cron-panel/components/cron-week.d.ts +25 -0
  151. package/lib/ele-cron-panel/components/cron-year.cjs +185 -0
  152. package/lib/ele-cron-panel/components/cron-year.d.ts +25 -0
  153. package/lib/ele-cron-panel/index.cjs +347 -0
  154. package/lib/ele-cron-panel/index.d.ts +14 -0
  155. package/lib/ele-cron-panel/props.cjs +14 -0
  156. package/lib/ele-cron-panel/props.d.ts +20 -0
  157. package/lib/ele-cron-panel/style/index.cjs +8 -0
  158. package/lib/ele-cron-panel/style/index.d.ts +1 -0
  159. package/lib/ele-cron-panel/style/index.scss +282 -0
  160. package/lib/ele-cron-panel/types.d.ts +118 -0
  161. package/lib/ele-cron-panel/util.cjs +542 -0
  162. package/lib/ele-cron-panel/util.d.ts +23 -0
  163. package/lib/ele-cropper/components/cropper-tools.d.ts +2 -2
  164. package/lib/ele-cropper-modal/index.d.ts +2 -4
  165. package/lib/ele-crud/index.d.ts +3 -3
  166. package/lib/ele-drawer/index.cjs +4 -0
  167. package/lib/ele-drawer/index.d.ts +9 -0
  168. package/lib/ele-drawer/props.cjs +6 -1
  169. package/lib/ele-drawer/props.d.ts +5 -0
  170. package/lib/ele-drawer/style/index.scss +11 -0
  171. package/lib/ele-file-list/index.d.ts +3 -3
  172. package/lib/ele-icon-select/components/icon-grid.cjs +19 -11
  173. package/lib/ele-icon-select/components/icon-grid.d.ts +8 -3
  174. package/lib/ele-icon-select/index.cjs +91 -85
  175. package/lib/ele-icon-select/index.d.ts +58 -59
  176. package/lib/ele-icon-select/props.cjs +34 -34
  177. package/lib/ele-icon-select/props.d.ts +35 -35
  178. package/lib/ele-icon-select/style/css-var.scss +1 -1
  179. package/lib/ele-icon-select/style/index.scss +50 -18
  180. package/lib/ele-icon-select/types.d.ts +13 -0
  181. package/lib/ele-map-picker/index.d.ts +3 -3
  182. package/lib/ele-modal/index.cjs +9 -3
  183. package/lib/ele-modal/index.d.ts +4 -2
  184. package/lib/ele-modal/props.cjs +2 -0
  185. package/lib/ele-modal/props.d.ts +2 -0
  186. package/lib/ele-modal/style/index.scss +16 -0
  187. package/lib/ele-pro-form/components/item-type-data.cjs +39 -64
  188. package/lib/ele-pro-form/index.d.ts +3 -3
  189. package/lib/ele-pro-table/components/table-tools.cjs +117 -247
  190. package/lib/ele-pro-table/components/table-tools.d.ts +12 -97
  191. package/lib/ele-pro-table/components/tool-export.cjs +32 -20
  192. package/lib/ele-pro-table/components/tool-export.d.ts +5 -1
  193. package/lib/ele-pro-table/components/tool-print.cjs +37 -25
  194. package/lib/ele-pro-table/components/tool-print.d.ts +5 -1
  195. package/lib/ele-pro-table/exceljs-plugin.cjs +81 -0
  196. package/lib/ele-pro-table/exceljs-plugin.d.ts +12 -0
  197. package/lib/ele-pro-table/index.cjs +143 -72
  198. package/lib/ele-pro-table/index.d.ts +6 -7
  199. package/lib/ele-pro-table/types.d.ts +11 -0
  200. package/lib/ele-split-panel/style/index.scss +1 -1
  201. package/lib/ele-table-select/index.d.ts +2 -0
  202. package/lib/ele-table-select/props.cjs +3 -1
  203. package/lib/ele-table-select/props.d.ts +2 -0
  204. package/lib/ele-tour/index.d.ts +3 -3
  205. package/lib/ele-tree-select/index.d.ts +2 -0
  206. package/lib/ele-upload-list/index.cjs +25 -8
  207. package/lib/ele-upload-list/index.d.ts +3 -3
  208. package/lib/ele-virtual-table/components/body-cell.d.ts +1 -1
  209. package/lib/ele-watermark/index.cjs +251 -92
  210. package/lib/ele-watermark/index.d.ts +20 -7
  211. package/lib/ele-watermark/props.cjs +10 -3
  212. package/lib/ele-watermark/props.d.ts +10 -3
  213. package/lib/ele-watermark/types.d.ts +12 -0
  214. package/lib/ele-watermark/util.cjs +10 -19
  215. package/lib/ele-watermark/util.d.ts +2 -9
  216. package/lib/lang/en_US.cjs +116 -0
  217. package/lib/lang/zh_CN.cjs +116 -0
  218. package/lib/lang/zh_TW.cjs +116 -0
  219. package/lib/style/plus.scss +3 -1
  220. package/lib/style/themes/default.scss +12 -3
  221. package/lib/style/themes/rounded.scss +2 -1
  222. package/lib/utils/theme-util.d.ts +1 -1
  223. package/package.json +1 -1
  224. package/typings/global.d.ts +2 -0
@@ -0,0 +1,81 @@
1
+ import ExcelJS from "exceljs";
2
+ import { download } from "../utils/common";
3
+ function getExportWorkbook(params) {
4
+ const { headerData, bodyData, footerData, bodyCols } = params;
5
+ const workbook = new ExcelJS.Workbook();
6
+ const sheet = workbook.addWorksheet("Sheet1");
7
+ const sheetRows = [];
8
+ const sheetStyles = [];
9
+ const sheetMerges = [];
10
+ const sheetRowHeight = [];
11
+ [...headerData, ...bodyData, ...footerData].forEach((item, index) => {
12
+ const sheetCols = [];
13
+ const rowStyles = [];
14
+ item.forEach((d, colIndex) => {
15
+ var _a;
16
+ if (!d.isTreeCell || !d.indent) {
17
+ sheetCols.push(d.text ?? "");
18
+ } else {
19
+ const gap = Array.from({ length: d.indent }).fill(" ").join("");
20
+ sheetCols.push(gap + (d.text ?? ""));
21
+ }
22
+ rowStyles.push({
23
+ font: { size: 12, bold: index < headerData.length },
24
+ alignment: {
25
+ vertical: d.isTreeIndex && d.rowspan !== 1 ? "top" : "middle",
26
+ horizontal: d.isExpandCell ? "left" : ((_a = d.column) == null ? void 0 : _a.align) || "left",
27
+ wrapText: d.isExpandCell ? true : false,
28
+ indent: d.isExpandCell ? 1 : 0
29
+ },
30
+ border: {
31
+ top: { style: "thin" },
32
+ left: d.hideLeftBorder ? {} : { style: "thin" },
33
+ bottom: { style: "thin" },
34
+ right: d.hideRightBorder ? {} : { style: "thin" }
35
+ }
36
+ });
37
+ if (d.rowspan && d.rowspan > 1 || d.colspan && d.colspan > 1) {
38
+ sheetMerges.push([
39
+ index + 1,
40
+ colIndex + 1,
41
+ index + (d.rowspan || 1),
42
+ colIndex + (d.colspan || 1)
43
+ ]);
44
+ }
45
+ });
46
+ sheetRows.push(sheetCols);
47
+ sheetStyles.push(rowStyles);
48
+ const expandCell = item.find((d) => d.isExpandCell && d.colspan);
49
+ const lines = String((expandCell == null ? void 0 : expandCell.text) ?? "").split("\n").length || 1;
50
+ sheetRowHeight.push(lines * 20);
51
+ });
52
+ sheet.addRows(sheetRows).forEach((row, index) => {
53
+ row.eachCell({ includeEmpty: true }, (cell, colIndex) => {
54
+ Object.assign(cell, sheetStyles[index][colIndex - 1]);
55
+ });
56
+ row.height = sheetRowHeight[index];
57
+ });
58
+ sheetMerges.forEach((merges) => {
59
+ sheet.mergeCells(merges);
60
+ });
61
+ bodyCols.forEach((col, colIndex) => {
62
+ const w = col.width ?? col.minWidth;
63
+ sheet.getColumn(colIndex + 1).width = w == null ? void 0 : w / 8;
64
+ });
65
+ return workbook;
66
+ }
67
+ const exceljsPlugin = function(params) {
68
+ return new Promise((resolve, reject) => {
69
+ getExportWorkbook(params).xlsx.writeBuffer().then((data) => {
70
+ download(data, `${params.fileName}.xlsx`);
71
+ resolve();
72
+ }).catch((e) => {
73
+ console.error(e);
74
+ reject(e);
75
+ });
76
+ });
77
+ };
78
+ export {
79
+ exceljsPlugin,
80
+ getExportWorkbook
81
+ };
@@ -2,16 +2,16 @@ import { Ref } from 'vue';
2
2
  import { EleDataTableProps, EleToolbarProps } from '../ele-app/plus';
3
3
  import { DataItem, Column, Columns, Sorter, Filter, RowKey } from '../ele-data-table/types';
4
4
  import { ReloadFunction, DoneParams, TableTool, FetchFunction, TableViewInstance, ExportConfig, PrintConfig, TableExportParams } from './types';
5
- import { TableToolsInstance } from './props';
6
5
 
7
- declare function __VLS_template(): Partial<Record<string, (_: {
8
- pageIndex: number | undefined;
9
- fetch: FetchFunction | undefined;
10
- }) => any>> & Partial<Record<string, (_: {
6
+ declare function __VLS_template(): Partial<Record<string, (_: {}) => any>> & Partial<Record<string, (_: {
11
7
  row: DataItem | undefined;
12
8
  column: Column;
13
9
  $index: number | undefined;
14
- }) => any>> & Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
10
+ }) => any>> & Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: {
11
+ row: DataItem | undefined;
12
+ column: Column;
13
+ $index: number;
14
+ }) => any>> & {
15
15
  topExtra?(_: {}): any;
16
16
  toolbar?(_: {}): any;
17
17
  tools?(_: {}): any;
@@ -184,7 +184,6 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
184
184
  reserveCurrent: BooleanConstructor;
185
185
  selectedRowKeys: import('vue').PropType<import('../ele-data-table/types').DataKey[]>;
186
186
  }>, {
187
- tableToolsRef: Ref<TableToolsInstance, TableToolsInstance>;
188
187
  tableViewRef: Ref<TableViewInstance, TableViewInstance>;
189
188
  tableData: Ref<{
190
189
  [x: string]: any;
@@ -1,6 +1,6 @@
1
- import { defineComponent, ref, shallowRef, computed, watch, onMounted, createBlock, openBlock, mergeProps as mergeProps$1, unref, withCtx, renderSlot, createCommentVNode, createElementBlock, normalizeProps, createSlots, renderList, guardReactiveProps, normalizeStyle, nextTick } from "vue";
2
- import { pick, getValue } from "../utils/common";
3
- import { useGlobalProps } from "../ele-config-provider/receiver";
1
+ import { defineComponent, ref, shallowRef, computed, watch, onMounted, createBlock, openBlock, mergeProps as mergeProps$1, unref, withCtx, renderSlot, createCommentVNode, createElementBlock, createVNode, normalizeProps, createSlots, renderList, guardReactiveProps, normalizeStyle, nextTick } from "vue";
2
+ import { pick, getValue, uuid } from "../utils/common";
3
+ import { useGlobalProps, useLocale } from "../ele-config-provider/receiver";
4
4
  import EleLoading from "../ele-loading/index";
5
5
  import ElePagination from "../ele-pagination/index";
6
6
  import { dataTablePropKeys } from "../ele-data-table/props";
@@ -9,6 +9,8 @@ import EleDataTable from "../ele-data-table/index";
9
9
  import EleVirtualTable from "../ele-virtual-table/index";
10
10
  import EleToolbar from "../ele-toolbar/index";
11
11
  import TableTools from "./components/table-tools";
12
+ import ToolExport from "./components/tool-export";
13
+ import ToolPrint from "./components/tool-print";
12
14
  import { getDefaultFilter, getTablePage, getTableLimit, getTableSize, getRowKey, getPaginationProps, mergeProps, cacheColWidth, getInitCacheColumns, reloadData, getRequestOrders, getRequestFilters, getRequestPages, getResponseResult, getResponseName, isAutoAmend, sortData } from "./util";
13
15
  import { proTableEmits, proTableProps } from "./props";
14
16
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -30,9 +32,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
30
32
  const pageSlotExcludes = [...toolsSlotExcludes, "printTop", "printBottom"];
31
33
  const props = __props;
32
34
  const emit = __emit;
35
+ const tableState = {
36
+ sorter: props.defaultSort ?? {},
37
+ filter: getDefaultFilter(props.columns),
38
+ where: props.where ?? {},
39
+ reloadId: null
40
+ };
41
+ const globalProps = useGlobalProps("table");
42
+ const { lang } = useLocale("table", props);
43
+ const tableViewRef = ref(null);
44
+ const getTableRef = () => {
45
+ return tableViewRef.value;
46
+ };
33
47
  const events = useEmits(emit);
34
48
  const methods = useMethods(() => getTableRef());
35
- const globalProps = useGlobalProps("table");
36
49
  const virtualTableEvents = {
37
50
  onEndEeached: (params) => {
38
51
  emit("endEeached", params);
@@ -44,13 +57,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
44
57
  emit("rowsRendered", params);
45
58
  }
46
59
  };
47
- const tableState = {
48
- sorter: props.defaultSort ?? {},
49
- filter: getDefaultFilter(props.columns),
50
- where: props.where ?? {}
51
- };
52
- const tableToolsRef = ref(null);
53
- const tableViewRef = ref(null);
60
+ const toolExportRef = ref(null);
61
+ const toolPrintRef = ref(null);
54
62
  const tableData = ref([]);
55
63
  const tablePage = ref(
56
64
  getTablePage(props.pagination, globalProps.value.pagination)
@@ -204,6 +212,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
204
212
  handleDone({ data, page, total, response: props.datasource });
205
213
  return;
206
214
  }
215
+ const tempId = uuid(8);
216
+ tableState.reloadId = tempId;
207
217
  if (!parent) {
208
218
  tableLoading.value = true;
209
219
  }
@@ -229,6 +239,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
229
239
  filter,
230
240
  parent
231
241
  }).then((response) => {
242
+ if (tableState.reloadId !== tempId) {
243
+ return;
244
+ }
232
245
  const parseData = props.parseData ?? globalProps.value.parseData;
233
246
  const result = parseData ? parseData(response) : response;
234
247
  const { data, total } = getResponseResult(
@@ -240,6 +253,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
240
253
  );
241
254
  requestCallback(data, total, parent, result, resolve);
242
255
  }).catch((e) => {
256
+ if (tableState.reloadId !== tempId) {
257
+ return;
258
+ }
243
259
  const errorMsg = e == null ? void 0 : e.message;
244
260
  requestCallback(
245
261
  errorMsg == null ? errorMsg : String(errorMsg),
@@ -404,9 +420,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
404
420
  const reloadTable = () => {
405
421
  methods.doLayout();
406
422
  };
407
- const getTableRef = () => {
408
- return tableViewRef.value;
409
- };
410
423
  const getData = () => {
411
424
  return tableData.value;
412
425
  };
@@ -450,23 +463,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
450
463
  });
451
464
  };
452
465
  const openPrintModal = () => {
453
- if (tableToolsRef.value) {
454
- tableToolsRef.value.openPrintModal();
466
+ if (toolPrintRef.value) {
467
+ toolPrintRef.value.openModal();
455
468
  }
456
469
  };
457
470
  const printData = (params) => {
458
- if (tableToolsRef.value) {
459
- tableToolsRef.value.printData(params);
471
+ if (toolPrintRef.value) {
472
+ toolPrintRef.value.printData(params);
460
473
  }
461
474
  };
462
475
  const openExportModal = () => {
463
- if (tableToolsRef.value) {
464
- tableToolsRef.value.openExportModal();
476
+ if (toolExportRef.value) {
477
+ toolExportRef.value.openModal();
465
478
  }
466
479
  };
467
480
  const exportData = (params) => {
468
- if (tableToolsRef.value) {
469
- tableToolsRef.value.exportData(params);
481
+ if (toolExportRef.value) {
482
+ toolExportRef.value.exportData(params);
470
483
  }
471
484
  };
472
485
  watch(
@@ -529,13 +542,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
529
542
  { deep: true }
530
543
  );
531
544
  onMounted(() => {
545
+ var _a;
546
+ if (props.current != null) {
547
+ methods.setCurrentRowKey(getValue(props.current, tableRowKey.value));
548
+ }
549
+ if ((_a = props.selections) == null ? void 0 : _a.length) {
550
+ methods.setSelectedRowKeys(
551
+ getRowKeys(props.selections, tableRowKey.value)
552
+ );
553
+ }
532
554
  if (props.loadOnCreated) {
533
555
  reload();
534
556
  }
535
557
  });
536
558
  __expose({
537
559
  ...methods,
538
- tableToolsRef,
539
560
  tableViewRef,
540
561
  tableData,
541
562
  tableLoading,
@@ -569,8 +590,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
569
590
  renderSlot(_ctx.$slots, "tools"),
570
591
  toolNames.value && toolNames.value.length ? (openBlock(), createBlock(TableTools, {
571
592
  key: 0,
572
- ref_key: "tableToolsRef",
573
- ref: tableToolsRef,
574
593
  tools: toolNames.value,
575
594
  size: tableSize.value,
576
595
  columns: _ctx.columns,
@@ -578,28 +597,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
578
597
  columnFixed: _ctx.columnFixed,
579
598
  maximized: tableMaximized.value,
580
599
  cacheKey: _ctx.cacheKey,
581
- locale: _ctx.locale,
582
- selections: _ctx.selections,
583
- pageData: tableData.value,
584
- spanMethod: _ctx.spanMethod,
585
- tableHeader: _ctx.showHeader,
586
- showSummary: _ctx.showSummary,
587
- sumText: _ctx.sumText,
588
- summaryMethod: _ctx.summaryMethod,
589
- tableStyle: _ctx.tableStyle,
590
- cellStyle: _ctx.cellStyle,
591
- cellClassName: _ctx.cellClassName,
592
- headerCellStyle: _ctx.headerCellStyle,
593
- headerCellClassName: _ctx.headerCellClassName,
594
- pageIndex: tableIndex.value,
595
- treeProps: _ctx.treeProps,
596
- fetch,
597
- exportConfig: toolExportConfig.value,
598
- printConfig: toolPrintConfig.value,
600
+ lang: unref(lang),
599
601
  onReload: handleRefresh,
600
602
  "onUpdate:size": handleSizeChange,
601
603
  "onUpdate:columns": handleColumnsChange,
602
- "onUpdate:maximized": handleMaximizedChange
604
+ "onUpdate:maximized": handleMaximizedChange,
605
+ onOpenExportModal: openExportModal,
606
+ onOpenPrintModal: openPrintModal
603
607
  }, createSlots({ _: 2 }, [
604
608
  renderList(Object.keys(_ctx.$slots).filter(
605
609
  (k) => !toolsSlotExcludes.includes(k)
@@ -611,7 +615,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
611
615
  ])
612
616
  };
613
617
  })
614
- ]), 1032, ["tools", "size", "columns", "columnSortable", "columnFixed", "maximized", "cacheKey", "locale", "selections", "pageData", "spanMethod", "tableHeader", "showSummary", "sumText", "summaryMethod", "tableStyle", "cellStyle", "cellClassName", "headerCellStyle", "headerCellClassName", "pageIndex", "treeProps", "exportConfig", "printConfig"])) : createCommentVNode("", true)
618
+ ]), 1032, ["tools", "size", "columns", "columnSortable", "columnFixed", "maximized", "cacheKey", "lang"])) : createCommentVNode("", true)
615
619
  ]),
616
620
  default: withCtx(() => [
617
621
  renderSlot(_ctx.$slots, "toolbar")
@@ -670,7 +674,74 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
670
674
  })
671
675
  ]), 1040)) : createCommentVNode("", true)
672
676
  ], 4)) : createCommentVNode("", true),
673
- renderSlot(_ctx.$slots, "bottomExtra")
677
+ renderSlot(_ctx.$slots, "bottomExtra"),
678
+ createVNode(ToolExport, {
679
+ ref_key: "toolExportRef",
680
+ ref: toolExportRef,
681
+ locale: unref(lang),
682
+ cacheKey: _ctx.cacheKey,
683
+ modalProps: toolExportConfig.value.modalProps,
684
+ columns: toolExportConfig.value.columns || _ctx.columns,
685
+ selections: _ctx.selections,
686
+ pageData: tableData.value,
687
+ datasource: toolExportConfig.value.datasource,
688
+ spanMethod: _ctx.spanMethod,
689
+ tableHeader: toolExportConfig.value.showHeader ?? _ctx.showHeader,
690
+ showSummary: _ctx.showSummary,
691
+ sumText: _ctx.sumText,
692
+ summaryMethod: _ctx.summaryMethod,
693
+ pageIndex: tableIndex.value,
694
+ treeProps: _ctx.treeProps,
695
+ fetch,
696
+ defaultFileName: toolExportConfig.value.fileName,
697
+ defaultDataType: toolExportConfig.value.dataType,
698
+ defaultShowFooter: toolExportConfig.value.showFooter,
699
+ defaultShowTreeIndex: toolExportConfig.value.showTreeIndex,
700
+ beforeExport: toolExportConfig.value.beforeExport,
701
+ exportPlugin: toolExportConfig.value.exportPlugin
702
+ }, null, 8, ["locale", "cacheKey", "modalProps", "columns", "selections", "pageData", "datasource", "spanMethod", "tableHeader", "showSummary", "sumText", "summaryMethod", "pageIndex", "treeProps", "defaultFileName", "defaultDataType", "defaultShowFooter", "defaultShowTreeIndex", "beforeExport", "exportPlugin"]),
703
+ createVNode(ToolPrint, {
704
+ ref_key: "toolPrintRef",
705
+ ref: toolPrintRef,
706
+ locale: unref(lang),
707
+ cacheKey: _ctx.cacheKey,
708
+ modalProps: toolPrintConfig.value.modalProps,
709
+ printerProps: toolPrintConfig.value.printerProps,
710
+ tableProps: toolPrintConfig.value.tableProps,
711
+ columns: toolPrintConfig.value.columns || _ctx.columns,
712
+ selections: _ctx.selections,
713
+ pageData: tableData.value,
714
+ datasource: toolPrintConfig.value.datasource,
715
+ spanMethod: _ctx.spanMethod,
716
+ tableHeader: toolPrintConfig.value.showHeader ?? _ctx.showHeader,
717
+ showSummary: _ctx.showSummary,
718
+ sumText: _ctx.sumText,
719
+ summaryMethod: _ctx.summaryMethod,
720
+ tableStyle: _ctx.tableStyle,
721
+ cellStyle: _ctx.cellStyle,
722
+ cellClassName: _ctx.cellClassName,
723
+ headerCellStyle: _ctx.headerCellStyle,
724
+ headerCellClassName: _ctx.headerCellClassName,
725
+ pageIndex: tableIndex.value,
726
+ treeProps: _ctx.treeProps,
727
+ fetch,
728
+ defaultDataType: toolPrintConfig.value.dataType,
729
+ defaultShowFooter: toolPrintConfig.value.showFooter,
730
+ defaultShowTreeIndex: toolPrintConfig.value.showTreeIndex,
731
+ beforePrint: toolPrintConfig.value.beforePrint,
732
+ printPlugin: toolPrintConfig.value.printPlugin
733
+ }, createSlots({ _: 2 }, [
734
+ renderList(Object.keys(_ctx.$slots).filter(
735
+ (k) => !toolsSlotExcludes.includes(k)
736
+ ), (name) => {
737
+ return {
738
+ name,
739
+ fn: withCtx((slotProps) => [
740
+ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps || {})))
741
+ ])
742
+ };
743
+ })
744
+ ]), 1032, ["locale", "cacheKey", "modalProps", "printerProps", "tableProps", "columns", "selections", "pageData", "datasource", "spanMethod", "tableHeader", "showSummary", "sumText", "summaryMethod", "tableStyle", "cellStyle", "cellClassName", "headerCellStyle", "headerCellClassName", "pageIndex", "treeProps", "defaultDataType", "defaultShowFooter", "defaultShowTreeIndex", "beforePrint", "printPlugin"])
674
745
  ]),
675
746
  _: 3
676
747
  }, 16, ["loading", "class", "style"]);
@@ -280,6 +280,8 @@ export interface TableState {
280
280
  filter: Filter;
281
281
  /** 当前搜索参数 */
282
282
  where: Where;
283
+ /** 当前查询任务标识 */
284
+ reloadId: string | null;
283
285
  }
284
286
 
285
287
  /**
@@ -396,6 +398,11 @@ export interface BeforeExportParams {
396
398
  */
397
399
  export type BeforeExport = (params: BeforeExportParams) => boolean | void;
398
400
 
401
+ /**
402
+ * 导出插件
403
+ */
404
+ export type ExportPlugin = (params: BeforeExportParams) => Promise<void>;
405
+
399
406
  /**
400
407
  * 导出配置
401
408
  */
@@ -418,6 +425,8 @@ export interface ExportConfig {
418
425
  showFooter?: boolean;
419
426
  /** 默认是否展示层级序号 */
420
427
  showTreeIndex?: boolean;
428
+ /** 导出插件 */
429
+ exportPlugin?: ExportPlugin;
421
430
  }
422
431
 
423
432
  /**
@@ -444,6 +453,8 @@ export interface PrintConfig {
444
453
  showFooter?: boolean;
445
454
  /** 默认是否展示层级序号 */
446
455
  showTreeIndex?: boolean;
456
+ /** 打印插件 */
457
+ printPlugin?: ExportPlugin;
447
458
  }
448
459
 
449
460
  /**
@@ -284,7 +284,7 @@
284
284
  flex-direction: column;
285
285
  overflow: auto;
286
286
 
287
- & > .el-table {
287
+ & > .ele-pro-table-view {
288
288
  flex: 1;
289
289
  height: 100%;
290
290
  }
@@ -12,11 +12,13 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
12
12
  tableRef: import('vue').Ref<EleProTableInstance, EleProTableInstance>;
13
13
  selectVisible: import('vue').Ref<boolean, boolean>;
14
14
  selectedItems: import('vue').Ref<{
15
+ [x: string]: any;
15
16
  label: string;
16
17
  value: SingleValue;
17
18
  hide?: boolean | undefined;
18
19
  index?: number | undefined;
19
20
  }[], SelectedItem[] | {
21
+ [x: string]: any;
20
22
  label: string;
21
23
  value: SingleValue;
22
24
  hide?: boolean | undefined;
@@ -117,4 +117,6 @@ export declare const tableSelectEmits: {
117
117
  select: (_item: DataItem | DataItem[]) => boolean;
118
118
  /** 筛选输入框值改变事件 */
119
119
  filterChange: (_value: string) => boolean;
120
+ /** 更新下拉框显示状态 */
121
+ 'update:visible': (_visible: boolean) => boolean;
120
122
  };
@@ -104,7 +104,9 @@ const tableSelectEmits = {
104
104
  /** 表格行选中事件 */
105
105
  select: (_item) => true,
106
106
  /** 筛选输入框值改变事件 */
107
- filterChange: (_value) => true
107
+ filterChange: (_value) => true,
108
+ /** 更新下拉框显示状态 */
109
+ "update:visible": (_visible) => true
108
110
  };
109
111
  export {
110
112
  tableSelectEmits,
@@ -1,6 +1,6 @@
1
1
  import { Ref } from 'vue';
2
2
  import { EleTooltipInstance } from '../ele-app/plus';
3
- import { TourStep, TourLocale } from './types';
3
+ import { TourStep } from './types';
4
4
 
5
5
  declare function __VLS_template(): {
6
6
  title?(_: {
@@ -31,7 +31,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
31
31
  default: number;
32
32
  };
33
33
  zIndex: NumberConstructor;
34
- locale: import('vue').PropType<Partial<TourLocale>>;
34
+ locale: import('vue').PropType<Partial<import('./types').TourLocale>>;
35
35
  }>, {
36
36
  tooltipRef: Ref<EleTooltipInstance, EleTooltipInstance>;
37
37
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
@@ -51,7 +51,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
51
51
  default: number;
52
52
  };
53
53
  zIndex: NumberConstructor;
54
- locale: import('vue').PropType<Partial<TourLocale>>;
54
+ locale: import('vue').PropType<Partial<import('./types').TourLocale>>;
55
55
  }>> & Readonly<{
56
56
  "onUpdate:modelValue"?: ((_value?: number | null | undefined) => any) | undefined;
57
57
  }>, {
@@ -59,11 +59,13 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
59
59
  selectRef: import('vue').Ref<EleBasicSelectInstance, EleBasicSelectInstance>;
60
60
  treeRef: import('vue').Ref<ElTreeV2Instance, ElTreeV2Instance>;
61
61
  selectedItems: import('vue').Ref<{
62
+ [x: string]: any;
62
63
  label: string;
63
64
  value: SingleValue;
64
65
  hide?: boolean | undefined;
65
66
  index?: number | undefined;
66
67
  }[], SelectedItem[] | {
68
+ [x: string]: any;
67
69
  label: string;
68
70
  value: SingleValue;
69
71
  hide?: boolean | undefined;
@@ -1,4 +1,4 @@
1
- import { UploadItem, UploadLocale } from './types';
1
+ import { UploadItem } from './types';
2
2
 
3
3
  declare function __VLS_template(): Partial<Record<string, (_: any) => any>> & {
4
4
  icon?(_: {}): any;
@@ -36,7 +36,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
36
36
  beforeUploadClick: import('vue').PropType<import('./types').BeforeUploadClick>;
37
37
  beforeItemEdit: import('vue').PropType<import('./types').BeforeItemEdit>;
38
38
  beforePreview: import('vue').PropType<import('./types').BeforePreview>;
39
- locale: import('vue').PropType<Partial<UploadLocale>>;
39
+ locale: import('vue').PropType<Partial<import('./types').UploadLocale>>;
40
40
  }>, {
41
41
  openImagePreview: (urls: string[], index: number) => void;
42
42
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
@@ -79,7 +79,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
79
79
  beforeUploadClick: import('vue').PropType<import('./types').BeforeUploadClick>;
80
80
  beforeItemEdit: import('vue').PropType<import('./types').BeforeItemEdit>;
81
81
  beforePreview: import('vue').PropType<import('./types').BeforePreview>;
82
- locale: import('vue').PropType<Partial<UploadLocale>>;
82
+ locale: import('vue').PropType<Partial<import('./types').UploadLocale>>;
83
83
  }>> & Readonly<{
84
84
  "onUpdate:modelValue"?: ((_value: UploadItem[]) => any) | undefined;
85
85
  onRemove?: ((_item: UploadItem) => any) | undefined;
@@ -128,13 +128,33 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
128
128
  e.preventDefault();
129
129
  }
130
130
  };
131
+ const clearImageObjectUrls = () => {
132
+ const temp = imageObjectUrls.value;
133
+ imageObjectUrls.value = [];
134
+ temp.forEach((item) => {
135
+ URL.revokeObjectURL(item.url);
136
+ });
137
+ };
131
138
  watch(
132
139
  () => props.modelValue,
133
140
  () => {
134
- if (props.modelValue != null) {
135
- props.modelValue.forEach((item) => {
136
- getItemImageUrl(item);
137
- });
141
+ if (props.modelValue == null) {
142
+ clearImageObjectUrls();
143
+ return;
144
+ }
145
+ const urls = [];
146
+ props.modelValue.forEach((item) => {
147
+ const url = getItemImageUrl(item);
148
+ if (url) {
149
+ urls.push(url);
150
+ }
151
+ });
152
+ for (let i = imageObjectUrls.value.length - 1; i >= 0; i--) {
153
+ const url = imageObjectUrls.value[i].url;
154
+ if (!urls.includes(url)) {
155
+ imageObjectUrls.value.splice(i, 1);
156
+ URL.revokeObjectURL(url);
157
+ }
138
158
  }
139
159
  },
140
160
  {
@@ -143,10 +163,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
143
163
  }
144
164
  );
145
165
  onBeforeUnmount(() => {
146
- imageObjectUrls.value.forEach((item) => {
147
- URL.revokeObjectURL(item.url);
148
- });
149
- imageObjectUrls.value = [];
166
+ clearImageObjectUrls();
150
167
  });
151
168
  __expose({
152
169
  openImagePreview
@@ -136,10 +136,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
136
136
  onCheckedChange?: ((_checked: boolean) => any) | undefined;
137
137
  }>, {
138
138
  loading: boolean;
139
+ isDisabled: boolean;
139
140
  fixedCellHeight: boolean;
140
141
  autoRowHeight: boolean;
141
142
  isChecked: boolean;
142
- isDisabled: boolean;
143
143
  hasChildren: boolean;
144
144
  isCollapse: boolean;
145
145
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;