bkui-vue 0.0.1-beta.214 → 0.0.1-beta.215

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/dist/index.esm.js CHANGED
@@ -7564,7 +7564,7 @@ class BKPopIndexManager {
7564
7564
  }
7565
7565
  }
7566
7566
  }
7567
- new BKPopIndexManager();
7567
+ const bkPopIndexManager = new BKPopIndexManager();
7568
7568
  /*!
7569
7569
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
7570
7570
  *
@@ -10200,7 +10200,6 @@ var Component$v = defineComponent({
10200
10200
  data() {
10201
10201
  return {
10202
10202
  visible: false,
10203
- bkPopIndexManager: null,
10204
10203
  closeTimer: null
10205
10204
  };
10206
10205
  },
@@ -10244,10 +10243,8 @@ var Component$v = defineComponent({
10244
10243
  },
10245
10244
  visible: {
10246
10245
  handler(val) {
10247
- var _a, _b;
10248
10246
  if (val) {
10249
- this.bkPopIndexManager = new BKPopIndexManager();
10250
- this.bkPopIndexManager.onMaskClick((_e) => {
10247
+ bkPopIndexManager.onMaskClick((_e) => {
10251
10248
  this.handleClickOutSide();
10252
10249
  });
10253
10250
  this.$nextTick(() => {
@@ -10255,21 +10252,22 @@ var Component$v = defineComponent({
10255
10252
  "background-color": "rgba(0,0,0,0)"
10256
10253
  };
10257
10254
  const appendStyle = this.showMask ? {} : hideMaskStyle;
10258
- this.bkPopIndexManager.show(this.$el, this.showMask, appendStyle, this.transfer, this.zIndex);
10255
+ bkPopIndexManager.show(this.$el, this.showMask, appendStyle, this.transfer, this.zIndex);
10259
10256
  this.$emit("shown");
10260
10257
  });
10261
10258
  } else {
10262
- (_a = this.bkPopIndexManager) == null ? void 0 : _a.hide(this.$el, this.transfer);
10263
- (_b = this.bkPopIndexManager) == null ? void 0 : _b.destroy();
10259
+ bkPopIndexManager == null ? void 0 : bkPopIndexManager.hide(this.$el, this.transfer);
10260
+ bkPopIndexManager == null ? void 0 : bkPopIndexManager.destroy();
10264
10261
  }
10265
10262
  },
10266
10263
  immediate: true
10267
10264
  }
10268
10265
  },
10269
10266
  beforeUnmount() {
10270
- var _a, _b;
10271
- (_a = this.bkPopIndexManager) == null ? void 0 : _a.hide(this.$el);
10272
- (_b = this.bkPopIndexManager) == null ? void 0 : _b.destroy();
10267
+ if (this.visible) {
10268
+ bkPopIndexManager == null ? void 0 : bkPopIndexManager.hide(this.$el);
10269
+ bkPopIndexManager == null ? void 0 : bkPopIndexManager.destroy();
10270
+ }
10273
10271
  },
10274
10272
  methods: {
10275
10273
  handleClickOutSide() {
@@ -16312,7 +16310,9 @@ const IColumnType = {
16312
16310
  }),
16313
16311
  PropTypes.bool,
16314
16312
  PropTypes.string
16315
- ]).def(false)
16313
+ ]).def(false),
16314
+ colspan: PropTypes.oneOfType([PropTypes.func.def(() => 1), PropTypes.number.def(1)]),
16315
+ rowspan: PropTypes.oneOfType([PropTypes.func.def(() => 1), PropTypes.number.def(1)])
16316
16316
  };
16317
16317
  const tableProps = {
16318
16318
  data: PropTypes.arrayOf(PropTypes.any).def([]),
@@ -17180,6 +17180,28 @@ const isColumnHidden = (settingFields, column, checked) => {
17180
17180
  const isSettingField = (col) => settingFields.some((field) => field.field === resolvePropVal(col, ["field", "type"], [col]));
17181
17181
  return isSettingField(column) && checked.length && !checked.includes(resolvePropVal(column, ["field", "type"], [column]));
17182
17182
  };
17183
+ const resolveColumnSpan = (column, colIndex, row, rowIndex, key2) => {
17184
+ if (typeof column[key2] === "function") {
17185
+ return Reflect.apply(column[key2], globalThis, [{
17186
+ column,
17187
+ colIndex,
17188
+ row,
17189
+ rowIndex
17190
+ }]);
17191
+ }
17192
+ if (typeof column[key2] === "number") {
17193
+ return column[key2];
17194
+ }
17195
+ return 1;
17196
+ };
17197
+ const resolveCellSpan = (column, colIndex, row, rowIndex) => {
17198
+ const colspan = resolveColumnSpan(column, colIndex, row, rowIndex, "colspan");
17199
+ const rowspan = resolveColumnSpan(column, colIndex, row, rowIndex, "rowspan");
17200
+ return {
17201
+ colspan,
17202
+ rowspan
17203
+ };
17204
+ };
17183
17205
  var TableCell = defineComponent({
17184
17206
  name: "TableCell",
17185
17207
  props: {
@@ -17760,7 +17782,7 @@ var useFixedColumn = (props2, colgroups, hasScrollY) => {
17760
17782
  let start2 = fixedPos === "right" ? length * opt : 1;
17761
17783
  let preOffset = 0;
17762
17784
  for (start2; ; ) {
17763
- start2 += -1 * opt;
17785
+ start2 = start2 + -1 * opt;
17764
17786
  const index = Math.abs(start2);
17765
17787
  const current = colgroups[index];
17766
17788
  const curFixedPos = resolveFixColPos(current);
@@ -18072,12 +18094,15 @@ class TableRender {
18072
18094
  const {
18073
18095
  resolveFixedColumnStyle
18074
18096
  } = useFixedColumn(this.props, this.colgroups);
18097
+ const skipRow = /* @__PURE__ */ new Map();
18098
+ const rowLength = rows.length;
18075
18099
  return createVNode("tbody", null, [rows.map((row, rowIndex) => {
18076
18100
  const rowStyle = [...formatPropAsArray(this.props.rowStyle, [row, rowIndex, this]), {
18077
18101
  "--row-height": `${this.getRowHeight(row, rowIndex)}px`
18078
18102
  }];
18079
18103
  const rowClass = [...formatPropAsArray(this.props.rowClass, [row, rowIndex, this]), `hover-${this.props.rowHover}`];
18080
18104
  const rowKey = row[TABLE_ROW_ATTRIBUTE.ROW_UID];
18105
+ let skipColumn = 0;
18081
18106
  return [createVNode(TableRow, {
18082
18107
  "key": rowKey
18083
18108
  }, {
@@ -18087,30 +18112,51 @@ class TableRender {
18087
18112
  "onClick": (e) => this.handleRowClick(e, row, rowIndex, rows),
18088
18113
  "onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows)
18089
18114
  }, [this.filterColgroups.map((column, index) => {
18090
- let _slot2;
18091
18115
  const cellStyle = [resolveFixedColumnStyle(column), ...formatPropAsArray(this.props.cellStyle, [column, index, row, rowIndex, this])];
18092
- const cellClass = [this.getColumnClass(column, index), ...formatPropAsArray(this.props.cellClass, [column, index, row, rowIndex, this]), {
18093
- "expand-row": row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND]
18094
- }];
18095
18116
  const tdCtxClass = {
18096
18117
  cell: true,
18097
18118
  "expand-cell": column.type === "expand"
18098
18119
  };
18099
18120
  const cellKey = `__CELL_${rowIndex}_${index}`;
18100
- return createVNode("td", {
18101
- "class": cellClass,
18102
- "style": cellStyle,
18103
- "key": cellKey,
18104
- "colspan": 1,
18105
- "rowspan": 1
18106
- }, [createVNode(TableCell, {
18107
- "class": tdCtxClass,
18108
- "column": column,
18109
- "row": row,
18110
- "parentSetting": this.props.showOverflowTooltip
18111
- }, _isSlot$1(_slot2 = this.renderCell(row, column, rowIndex, rows)) ? _slot2 : {
18112
- default: () => [_slot2]
18113
- })]);
18121
+ const {
18122
+ colspan,
18123
+ rowspan
18124
+ } = resolveCellSpan(column, index, row, rowIndex);
18125
+ const skipCurrentRow = skipRow.get(index);
18126
+ if (skipColumn === 0 && !skipCurrentRow) {
18127
+ let _slot2;
18128
+ if (colspan > 1) {
18129
+ skipColumn = colspan - 1;
18130
+ }
18131
+ if (rowspan > 1) {
18132
+ skipRow.set(index, rowspan - 1);
18133
+ }
18134
+ const cellClass = [this.getColumnClass(column, index), ...formatPropAsArray(this.props.cellClass, [column, index, row, rowIndex, this]), {
18135
+ "expand-row": row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND],
18136
+ "is-last": rowIndex + rowspan >= rowLength
18137
+ }];
18138
+ return createVNode("td", {
18139
+ "class": cellClass,
18140
+ "style": cellStyle,
18141
+ "key": cellKey,
18142
+ "colspan": colspan,
18143
+ "rowspan": rowspan
18144
+ }, [createVNode(TableCell, {
18145
+ "class": tdCtxClass,
18146
+ "column": column,
18147
+ "row": row,
18148
+ "parentSetting": this.props.showOverflowTooltip
18149
+ }, _isSlot$1(_slot2 = this.renderCell(row, column, rowIndex, rows)) ? _slot2 : {
18150
+ default: () => [_slot2]
18151
+ })]);
18152
+ }
18153
+ if (skipColumn > 0) {
18154
+ skipColumn = skipColumn - 1;
18155
+ }
18156
+ if (skipCurrentRow > 0) {
18157
+ skipRow.set(index, skipCurrentRow - 1);
18158
+ }
18159
+ return null;
18114
18160
  })])]
18115
18161
  }), this.renderExpandRow(row, rowClass)];
18116
18162
  })]);