bkui-vue 0.0.1-beta.213 → 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
  },
@@ -10240,34 +10239,35 @@ var Component$v = defineComponent({
10240
10239
  }, 250);
10241
10240
  }
10242
10241
  },
10243
- immediate: true,
10244
- deep: true
10242
+ immediate: true
10245
10243
  },
10246
- visible(val) {
10247
- var _a, _b;
10248
- if (val) {
10249
- this.bkPopIndexManager = new BKPopIndexManager();
10250
- this.bkPopIndexManager.onMaskClick((_e) => {
10251
- this.handleClickOutSide();
10252
- });
10253
- this.$nextTick(() => {
10254
- const hideMaskStyle = {
10255
- "background-color": "rgba(0,0,0,0)"
10256
- };
10257
- const appendStyle = this.showMask ? {} : hideMaskStyle;
10258
- this.bkPopIndexManager.show(this.$el, this.showMask, appendStyle, this.transfer, this.zIndex);
10259
- this.$emit("shown");
10260
- });
10261
- } else {
10262
- (_a = this.bkPopIndexManager) == null ? void 0 : _a.hide(this.$el, this.transfer);
10263
- (_b = this.bkPopIndexManager) == null ? void 0 : _b.destroy();
10264
- }
10244
+ visible: {
10245
+ handler(val) {
10246
+ if (val) {
10247
+ bkPopIndexManager.onMaskClick((_e) => {
10248
+ this.handleClickOutSide();
10249
+ });
10250
+ this.$nextTick(() => {
10251
+ const hideMaskStyle = {
10252
+ "background-color": "rgba(0,0,0,0)"
10253
+ };
10254
+ const appendStyle = this.showMask ? {} : hideMaskStyle;
10255
+ bkPopIndexManager.show(this.$el, this.showMask, appendStyle, this.transfer, this.zIndex);
10256
+ this.$emit("shown");
10257
+ });
10258
+ } else {
10259
+ bkPopIndexManager == null ? void 0 : bkPopIndexManager.hide(this.$el, this.transfer);
10260
+ bkPopIndexManager == null ? void 0 : bkPopIndexManager.destroy();
10261
+ }
10262
+ },
10263
+ immediate: true
10265
10264
  }
10266
10265
  },
10267
10266
  beforeUnmount() {
10268
- var _a, _b;
10269
- (_a = this.bkPopIndexManager) == null ? void 0 : _a.hide(this.$el);
10270
- (_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
+ }
10271
10271
  },
10272
10272
  methods: {
10273
10273
  handleClickOutSide() {
@@ -16310,7 +16310,9 @@ const IColumnType = {
16310
16310
  }),
16311
16311
  PropTypes.bool,
16312
16312
  PropTypes.string
16313
- ]).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)])
16314
16316
  };
16315
16317
  const tableProps = {
16316
16318
  data: PropTypes.arrayOf(PropTypes.any).def([]),
@@ -17178,6 +17180,28 @@ const isColumnHidden = (settingFields, column, checked) => {
17178
17180
  const isSettingField = (col) => settingFields.some((field) => field.field === resolvePropVal(col, ["field", "type"], [col]));
17179
17181
  return isSettingField(column) && checked.length && !checked.includes(resolvePropVal(column, ["field", "type"], [column]));
17180
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
+ };
17181
17205
  var TableCell = defineComponent({
17182
17206
  name: "TableCell",
17183
17207
  props: {
@@ -17758,7 +17782,7 @@ var useFixedColumn = (props2, colgroups, hasScrollY) => {
17758
17782
  let start2 = fixedPos === "right" ? length * opt : 1;
17759
17783
  let preOffset = 0;
17760
17784
  for (start2; ; ) {
17761
- start2 += -1 * opt;
17785
+ start2 = start2 + -1 * opt;
17762
17786
  const index = Math.abs(start2);
17763
17787
  const current = colgroups[index];
17764
17788
  const curFixedPos = resolveFixColPos(current);
@@ -18070,12 +18094,15 @@ class TableRender {
18070
18094
  const {
18071
18095
  resolveFixedColumnStyle
18072
18096
  } = useFixedColumn(this.props, this.colgroups);
18097
+ const skipRow = /* @__PURE__ */ new Map();
18098
+ const rowLength = rows.length;
18073
18099
  return createVNode("tbody", null, [rows.map((row, rowIndex) => {
18074
18100
  const rowStyle = [...formatPropAsArray(this.props.rowStyle, [row, rowIndex, this]), {
18075
18101
  "--row-height": `${this.getRowHeight(row, rowIndex)}px`
18076
18102
  }];
18077
18103
  const rowClass = [...formatPropAsArray(this.props.rowClass, [row, rowIndex, this]), `hover-${this.props.rowHover}`];
18078
18104
  const rowKey = row[TABLE_ROW_ATTRIBUTE.ROW_UID];
18105
+ let skipColumn = 0;
18079
18106
  return [createVNode(TableRow, {
18080
18107
  "key": rowKey
18081
18108
  }, {
@@ -18085,30 +18112,51 @@ class TableRender {
18085
18112
  "onClick": (e) => this.handleRowClick(e, row, rowIndex, rows),
18086
18113
  "onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows)
18087
18114
  }, [this.filterColgroups.map((column, index) => {
18088
- let _slot2;
18089
18115
  const cellStyle = [resolveFixedColumnStyle(column), ...formatPropAsArray(this.props.cellStyle, [column, index, row, rowIndex, this])];
18090
- const cellClass = [this.getColumnClass(column, index), ...formatPropAsArray(this.props.cellClass, [column, index, row, rowIndex, this]), {
18091
- "expand-row": row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND]
18092
- }];
18093
18116
  const tdCtxClass = {
18094
18117
  cell: true,
18095
18118
  "expand-cell": column.type === "expand"
18096
18119
  };
18097
18120
  const cellKey = `__CELL_${rowIndex}_${index}`;
18098
- return createVNode("td", {
18099
- "class": cellClass,
18100
- "style": cellStyle,
18101
- "key": cellKey,
18102
- "colspan": 1,
18103
- "rowspan": 1
18104
- }, [createVNode(TableCell, {
18105
- "class": tdCtxClass,
18106
- "column": column,
18107
- "row": row,
18108
- "parentSetting": this.props.showOverflowTooltip
18109
- }, _isSlot$1(_slot2 = this.renderCell(row, column, rowIndex, rows)) ? _slot2 : {
18110
- default: () => [_slot2]
18111
- })]);
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;
18112
18160
  })])]
18113
18161
  }), this.renderExpandRow(row, rowClass)];
18114
18162
  })]);