@fmdeui/fmui 1.0.113 → 1.0.114

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.
@@ -38,6 +38,10 @@ interface iVxeOption {
38
38
  footerData?: VxeTablePropTypes.FooterData;
39
39
  footerMethod?: VxeTablePropTypes.FooterMethod<any>;
40
40
  remoteCustom?: boolean;
41
+ spanRules?: Array<{
42
+ valueField: string;
43
+ targetFields: string[];
44
+ }>;
41
45
  }
42
46
  /**
43
47
  * Vxe表格参数化Hook
@@ -7,7 +7,7 @@ import '../api/index.mjs';
7
7
  import { useBaseApi } from '../api/base/index.mjs';
8
8
 
9
9
  const useVxeTable = (opt, extras) => {
10
- var _a, _b;
10
+ var _a, _b, _c;
11
11
  const vxeSize = useThemeConfig().themeConfig.globalComponentSize == "small" ? "mini" : useThemeConfig().themeConfig.globalComponentSize == "default" ? "small" : "medium";
12
12
  const userStore = useUserInfo();
13
13
  const processColumns = (columns) => {
@@ -58,7 +58,25 @@ const useVxeTable = (opt, extras) => {
58
58
  }
59
59
  }
60
60
  }
61
- } : opt.spanMethod ? opt.spanMethod : ({ row, rowIndex, column, visibleData }) => {
61
+ } : opt.spanMethod ? opt.spanMethod : opt.spanRules && ((_c = opt.spanRules) == null ? void 0 : _c.length) > 0 ? ({ row, rowIndex, column, visibleData }) => {
62
+ if (!opt.spanRules || opt.spanRules.length === 0) return void 0;
63
+ const rule = opt.spanRules.find((r) => r.targetFields.includes(column.field));
64
+ if (!rule) return;
65
+ const cellValue = row[rule.valueField];
66
+ if (!cellValue && cellValue !== 0) return;
67
+ const prevRow = visibleData[rowIndex - 1];
68
+ if (prevRow && prevRow[rule.valueField] === cellValue) {
69
+ return { rowspan: 0, colspan: 0 };
70
+ }
71
+ let rowspanCount = 1;
72
+ let nextIndex = rowIndex + 1;
73
+ while (nextIndex < visibleData.length && visibleData[nextIndex][rule.valueField] === cellValue) {
74
+ rowspanCount++;
75
+ nextIndex++;
76
+ }
77
+ if (rowspanCount > 1)
78
+ return { rowspan: rowspanCount, colspan: 1 };
79
+ } : ({ row, rowIndex, column, visibleData }) => {
62
80
  };
63
81
  const options = reactive({
64
82
  stripe: false,
@@ -159,11 +177,11 @@ const useVxeTable = (opt, extras) => {
159
177
  }
160
178
  if (opt.remoteCustom && options.customConfig != void 0) {
161
179
  options.customConfig.restoreStore = async ({ id, storeData }) => {
162
- var _a2, _b2, _c, _d;
180
+ var _a2, _b2, _c2, _d;
163
181
  const { data } = await useBaseApi("sysColumnCustom").get({ id }, "sysColumnCustomDetail");
164
182
  if ((_a2 = data.result) == null ? void 0 : _a2.fixedData) storeData.fixedData = data.result.fixedData;
165
183
  if ((_b2 = data.result) == null ? void 0 : _b2.resizableData) storeData.resizableData = data.result.resizableData;
166
- if ((_c = data.result) == null ? void 0 : _c.sortData) storeData.sortData = data.result.sortData;
184
+ if ((_c2 = data.result) == null ? void 0 : _c2.sortData) storeData.sortData = data.result.sortData;
167
185
  if ((_d = data.result) == null ? void 0 : _d.visibleData) storeData.visibleData = data.result.visibleData;
168
186
  return storeData;
169
187
  };
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fmdeui-fmui v1.0.113 */
1
+ /*! fmdeui-fmui v1.0.114 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vxe-table'), require('@vxe-ui/plugin-render-element'), require('@vxe-ui/plugin-export-xlsx'), require('vxe-pc-ui'), require('exceljs'), require('@element-plus/icons-vue'), require('vue'), require('element-plus'), require('lodash-es'), require('js-cookie'), require('pinia'), require('vue-router'), require('@vueuse/core'), require('crypto-js'), require('xlsx-js-style'), require('vue-i18n'), require('sortablejs'), require('screenfull'), require('push.js'), require('mitt'), require('@microsoft/signalr'), require('axios')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'vxe-table', '@vxe-ui/plugin-render-element', '@vxe-ui/plugin-export-xlsx', 'vxe-pc-ui', 'exceljs', '@element-plus/icons-vue', 'vue', 'element-plus', 'lodash-es', 'js-cookie', 'pinia', 'vue-router', '@vueuse/core', 'crypto-js', 'xlsx-js-style', 'vue-i18n', 'sortablejs', 'screenfull', 'push.js', 'mitt', '@microsoft/signalr', 'axios'], factory) :
@@ -20438,7 +20438,7 @@
20438
20438
  }
20439
20439
 
20440
20440
  const useVxeTable = (opt, extras) => {
20441
- var _a, _b;
20441
+ var _a, _b, _c;
20442
20442
  const vxeSize = useThemeConfig().themeConfig.globalComponentSize == "small" ? "mini" : useThemeConfig().themeConfig.globalComponentSize == "default" ? "small" : "medium";
20443
20443
  const userStore = useUserInfo();
20444
20444
  const processColumns = (columns) => {
@@ -20489,7 +20489,25 @@
20489
20489
  }
20490
20490
  }
20491
20491
  }
20492
- } : opt.spanMethod ? opt.spanMethod : ({ row, rowIndex, column, visibleData }) => {
20492
+ } : opt.spanMethod ? opt.spanMethod : opt.spanRules && ((_c = opt.spanRules) == null ? void 0 : _c.length) > 0 ? ({ row, rowIndex, column, visibleData }) => {
20493
+ if (!opt.spanRules || opt.spanRules.length === 0) return void 0;
20494
+ const rule = opt.spanRules.find((r) => r.targetFields.includes(column.field));
20495
+ if (!rule) return;
20496
+ const cellValue = row[rule.valueField];
20497
+ if (!cellValue && cellValue !== 0) return;
20498
+ const prevRow = visibleData[rowIndex - 1];
20499
+ if (prevRow && prevRow[rule.valueField] === cellValue) {
20500
+ return { rowspan: 0, colspan: 0 };
20501
+ }
20502
+ let rowspanCount = 1;
20503
+ let nextIndex = rowIndex + 1;
20504
+ while (nextIndex < visibleData.length && visibleData[nextIndex][rule.valueField] === cellValue) {
20505
+ rowspanCount++;
20506
+ nextIndex++;
20507
+ }
20508
+ if (rowspanCount > 1)
20509
+ return { rowspan: rowspanCount, colspan: 1 };
20510
+ } : ({ row, rowIndex, column, visibleData }) => {
20493
20511
  };
20494
20512
  const options = vue.reactive({
20495
20513
  stripe: false,
@@ -20590,11 +20608,11 @@
20590
20608
  }
20591
20609
  if (opt.remoteCustom && options.customConfig != void 0) {
20592
20610
  options.customConfig.restoreStore = async ({ id, storeData }) => {
20593
- var _a2, _b2, _c, _d;
20611
+ var _a2, _b2, _c2, _d;
20594
20612
  const { data } = await useBaseApi("sysColumnCustom").get({ id }, "sysColumnCustomDetail");
20595
20613
  if ((_a2 = data.result) == null ? void 0 : _a2.fixedData) storeData.fixedData = data.result.fixedData;
20596
20614
  if ((_b2 = data.result) == null ? void 0 : _b2.resizableData) storeData.resizableData = data.result.resizableData;
20597
- if ((_c = data.result) == null ? void 0 : _c.sortData) storeData.sortData = data.result.sortData;
20615
+ if ((_c2 = data.result) == null ? void 0 : _c2.sortData) storeData.sortData = data.result.sortData;
20598
20616
  if ((_d = data.result) == null ? void 0 : _d.visibleData) storeData.visibleData = data.result.visibleData;
20599
20617
  return storeData;
20600
20618
  };