@fmdevui/fm-dev 1.0.59 → 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/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! fm-dev v1.0.59 */
1
+ /*! fm-dev v1.0.60 */
2
2
  import { defineComponent, reactive, computed, watch, resolveComponent, createBlock, openBlock, withCtx, createVNode, createElementVNode, createTextVNode, toDisplayString as toDisplayString$1, withDirectives, createElementBlock, Fragment, renderList, vShow, ref, onMounted, nextTick, normalizeStyle, createCommentVNode, normalizeClass, withModifiers, mergeModels, useModel, effectScope, getCurrentInstance, shallowRef, isRef as isRef$1, inject, onUnmounted, h, Text, resolveDynamicComponent, markRaw, toRaw as toRaw$1, hasInjectionContext, unref, isReactive as isReactive$1, toRef, getCurrentScope, onScopeDispose, toRefs, resolveDirective } from 'vue';
3
3
  import crypto from 'crypto';
4
4
  import require$$0 from 'url';
@@ -52803,6 +52803,8 @@ var merge = createAssigner(function(object, source, srcIndex) {
52803
52803
  const vxeSize = useThemeConfig(pinia).themeConfig.globalComponentSize == "small" ? "mini" : useThemeConfig(pinia).themeConfig.globalComponentSize == "default" ? "small" : "medium";
52804
52804
  const useVxeTable = (opt, extras) => {
52805
52805
  opt.id = opt.id ? opt.id : String((/* @__PURE__ */ new Date()).getTime());
52806
+ const spanFields = opt.spanFields ?? [];
52807
+ const spanValueField = opt.spanValueField ?? "id";
52806
52808
  const options = reactive({
52807
52809
  id: opt.id,
52808
52810
  height: "auto",
@@ -52812,7 +52814,24 @@ const useVxeTable = (opt, extras) => {
52812
52814
  align: "center",
52813
52815
  // 自动监听父元素的变化去重新计算表格(对于父元素可能存在动态变化、显示隐藏的容器中、列宽异常等场景中的可能会用到)
52814
52816
  // data: [] as Array<T>,
52815
- spanMethod: opt.spanMethod,
52817
+ spanMethod: spanFields ? ({ row, rowIndex, column, visibleData }) => {
52818
+ const cellValue = row[spanValueField];
52819
+ if (cellValue && spanFields.includes(column.field)) {
52820
+ const prevRow = visibleData[rowIndex - 1];
52821
+ let nextRow = visibleData[rowIndex + 1];
52822
+ if (prevRow && prevRow[spanValueField] === cellValue) {
52823
+ return { rowspan: 0, colspan: 0 };
52824
+ } else {
52825
+ let countRowspan = 1;
52826
+ while (nextRow && nextRow[spanValueField] === cellValue) {
52827
+ nextRow = visibleData[++countRowspan + rowIndex];
52828
+ }
52829
+ if (countRowspan > 1) {
52830
+ return { rowspan: countRowspan, colspan: 1 };
52831
+ }
52832
+ }
52833
+ }
52834
+ } : opt.spanMethod,
52816
52835
  columns: opt.columns,
52817
52836
  showFooter: opt.showFooter,
52818
52837
  footerData: opt.footerData,
@@ -12,6 +12,8 @@ import { VNode } from 'vue';
12
12
  interface iVxeOption {
13
13
  id?: string;
14
14
  name?: string;
15
+ spanFields?: Array<string>;
16
+ spanValueField?: string;
15
17
  spanMethod: VxeTablePropTypes.SpanMethod<any>;
16
18
  columns: VxeGridPropTypes.Columns<any>;
17
19
  data?: VxeTablePropTypes.Data<any>;
@@ -10,6 +10,8 @@ var inpinia = require('../stores/inpinia.js');
10
10
  const vxeSize = themeConfig.useThemeConfig(inpinia.pinia).themeConfig.globalComponentSize == "small" ? "mini" : themeConfig.useThemeConfig(inpinia.pinia).themeConfig.globalComponentSize == "default" ? "small" : "medium";
11
11
  const useVxeTable = (opt, extras) => {
12
12
  opt.id = opt.id ? opt.id : String((/* @__PURE__ */ new Date()).getTime());
13
+ const spanFields = opt.spanFields ?? [];
14
+ const spanValueField = opt.spanValueField ?? "id";
13
15
  const options = vue.reactive({
14
16
  id: opt.id,
15
17
  height: "auto",
@@ -19,7 +21,24 @@ const useVxeTable = (opt, extras) => {
19
21
  align: "center",
20
22
  // 自动监听父元素的变化去重新计算表格(对于父元素可能存在动态变化、显示隐藏的容器中、列宽异常等场景中的可能会用到)
21
23
  // data: [] as Array<T>,
22
- spanMethod: opt.spanMethod,
24
+ spanMethod: spanFields ? ({ row, rowIndex, column, visibleData }) => {
25
+ const cellValue = row[spanValueField];
26
+ if (cellValue && spanFields.includes(column.field)) {
27
+ const prevRow = visibleData[rowIndex - 1];
28
+ let nextRow = visibleData[rowIndex + 1];
29
+ if (prevRow && prevRow[spanValueField] === cellValue) {
30
+ return { rowspan: 0, colspan: 0 };
31
+ } else {
32
+ let countRowspan = 1;
33
+ while (nextRow && nextRow[spanValueField] === cellValue) {
34
+ nextRow = visibleData[++countRowspan + rowIndex];
35
+ }
36
+ if (countRowspan > 1) {
37
+ return { rowspan: countRowspan, colspan: 1 };
38
+ }
39
+ }
40
+ }
41
+ } : opt.spanMethod,
23
42
  columns: opt.columns,
24
43
  showFooter: opt.showFooter,
25
44
  footerData: opt.footerData,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fmdevui/fm-dev",
3
- "version": "1.0.59",
3
+ "version": "1.0.60",
4
4
  "description": "Page level components developed based on Element Plus.",
5
5
  "author": "fmdevui",
6
6
  "keywords": [
File without changes