@fmdevui/fm-dev 1.0.58 → 1.0.60
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.
- package/es/core/hook/useVxeTableOptionsHook.d.ts +3 -0
- package/es/packages/core/hook/useVxeTableOptionsHook.mjs +20 -0
- package/index.js +21 -1
- package/index.min.js +2 -2
- package/index.min.mjs +2 -2
- package/index.mjs +21 -1
- package/lib/core/hook/useVxeTableOptionsHook.d.ts +3 -0
- package/lib/packages/core/hook/useVxeTableOptionsHook.js +20 -0
- package/package.json +1 -1
|
@@ -12,6 +12,9 @@ import { VNode } from 'vue';
|
|
|
12
12
|
interface iVxeOption {
|
|
13
13
|
id?: string;
|
|
14
14
|
name?: string;
|
|
15
|
+
spanFields?: Array<string>;
|
|
16
|
+
spanValueField?: string;
|
|
17
|
+
spanMethod: VxeTablePropTypes.SpanMethod<any>;
|
|
15
18
|
columns: VxeGridPropTypes.Columns<any>;
|
|
16
19
|
data?: VxeTablePropTypes.Data<any>;
|
|
17
20
|
sortConfig?: VxeTablePropTypes.SortConfig<any>;
|
|
@@ -8,6 +8,8 @@ import { pinia } from '../stores/inpinia.mjs';
|
|
|
8
8
|
const vxeSize = useThemeConfig(pinia).themeConfig.globalComponentSize == "small" ? "mini" : useThemeConfig(pinia).themeConfig.globalComponentSize == "default" ? "small" : "medium";
|
|
9
9
|
const useVxeTable = (opt, extras) => {
|
|
10
10
|
opt.id = opt.id ? opt.id : String((/* @__PURE__ */ new Date()).getTime());
|
|
11
|
+
const spanFields = opt.spanFields ?? [];
|
|
12
|
+
const spanValueField = opt.spanValueField ?? "id";
|
|
11
13
|
const options = reactive({
|
|
12
14
|
id: opt.id,
|
|
13
15
|
height: "auto",
|
|
@@ -17,6 +19,24 @@ const useVxeTable = (opt, extras) => {
|
|
|
17
19
|
align: "center",
|
|
18
20
|
// 自动监听父元素的变化去重新计算表格(对于父元素可能存在动态变化、显示隐藏的容器中、列宽异常等场景中的可能会用到)
|
|
19
21
|
// data: [] as Array<T>,
|
|
22
|
+
spanMethod: spanFields ? ({ row, rowIndex, column, visibleData }) => {
|
|
23
|
+
const cellValue = row[spanValueField];
|
|
24
|
+
if (cellValue && spanFields.includes(column.field)) {
|
|
25
|
+
const prevRow = visibleData[rowIndex - 1];
|
|
26
|
+
let nextRow = visibleData[rowIndex + 1];
|
|
27
|
+
if (prevRow && prevRow[spanValueField] === cellValue) {
|
|
28
|
+
return { rowspan: 0, colspan: 0 };
|
|
29
|
+
} else {
|
|
30
|
+
let countRowspan = 1;
|
|
31
|
+
while (nextRow && nextRow[spanValueField] === cellValue) {
|
|
32
|
+
nextRow = visibleData[++countRowspan + rowIndex];
|
|
33
|
+
}
|
|
34
|
+
if (countRowspan > 1) {
|
|
35
|
+
return { rowspan: countRowspan, colspan: 1 };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
} : opt.spanMethod,
|
|
20
40
|
columns: opt.columns,
|
|
21
41
|
showFooter: opt.showFooter,
|
|
22
42
|
footerData: opt.footerData,
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! fm-dev v1.0.
|
|
1
|
+
/*! fm-dev v1.0.60 */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('crypto'), require('url'), require('http'), require('https'), require('util'), require('stream'), require('assert'), require('zlib'), require('element-plus')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'crypto', 'url', 'http', 'https', 'util', 'stream', 'assert', 'zlib', 'element-plus'], factory) :
|
|
@@ -52798,6 +52798,8 @@
|
|
|
52798
52798
|
const vxeSize = useThemeConfig(pinia).themeConfig.globalComponentSize == "small" ? "mini" : useThemeConfig(pinia).themeConfig.globalComponentSize == "default" ? "small" : "medium";
|
|
52799
52799
|
const useVxeTable = (opt, extras) => {
|
|
52800
52800
|
opt.id = opt.id ? opt.id : String((/* @__PURE__ */ new Date()).getTime());
|
|
52801
|
+
const spanFields = opt.spanFields ?? [];
|
|
52802
|
+
const spanValueField = opt.spanValueField ?? "id";
|
|
52801
52803
|
const options = vue.reactive({
|
|
52802
52804
|
id: opt.id,
|
|
52803
52805
|
height: "auto",
|
|
@@ -52807,6 +52809,24 @@
|
|
|
52807
52809
|
align: "center",
|
|
52808
52810
|
// 自动监听父元素的变化去重新计算表格(对于父元素可能存在动态变化、显示隐藏的容器中、列宽异常等场景中的可能会用到)
|
|
52809
52811
|
// data: [] as Array<T>,
|
|
52812
|
+
spanMethod: spanFields ? ({ row, rowIndex, column, visibleData }) => {
|
|
52813
|
+
const cellValue = row[spanValueField];
|
|
52814
|
+
if (cellValue && spanFields.includes(column.field)) {
|
|
52815
|
+
const prevRow = visibleData[rowIndex - 1];
|
|
52816
|
+
let nextRow = visibleData[rowIndex + 1];
|
|
52817
|
+
if (prevRow && prevRow[spanValueField] === cellValue) {
|
|
52818
|
+
return { rowspan: 0, colspan: 0 };
|
|
52819
|
+
} else {
|
|
52820
|
+
let countRowspan = 1;
|
|
52821
|
+
while (nextRow && nextRow[spanValueField] === cellValue) {
|
|
52822
|
+
nextRow = visibleData[++countRowspan + rowIndex];
|
|
52823
|
+
}
|
|
52824
|
+
if (countRowspan > 1) {
|
|
52825
|
+
return { rowspan: countRowspan, colspan: 1 };
|
|
52826
|
+
}
|
|
52827
|
+
}
|
|
52828
|
+
}
|
|
52829
|
+
} : opt.spanMethod,
|
|
52810
52830
|
columns: opt.columns,
|
|
52811
52831
|
showFooter: opt.showFooter,
|
|
52812
52832
|
footerData: opt.footerData,
|