bkui-vue 0.0.1-beta.214 → 0.0.1-beta.216
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.cjs.js +37 -37
- package/dist/index.esm.js +128 -35
- package/dist/index.umd.js +37 -37
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/modal/index.d.ts +0 -4
- package/lib/modal/index.js +1 -1
- package/lib/modal/modal.d.ts +0 -1
- package/lib/table/components/table-column.d.ts +4 -0
- package/lib/table/const.d.ts +1 -0
- package/lib/table/index.d.ts +8 -0
- package/lib/table/index.js +1 -1
- package/lib/table/props.d.ts +4 -0
- package/lib/table/table.css +4 -0
- package/lib/table/table.less +4 -0
- package/lib/table/table.variable.css +4 -0
- package/lib/table/utils.d.ts +6 -0
- package/lib/table-column/index.d.ts +8 -0
- package/lib/table-column/index.js +1 -1
- package/package.json +1 -1
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
|
-
|
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
|
-
|
10255
|
+
bkPopIndexManager.show(this.$el, this.showMask, appendStyle, this.transfer, this.zIndex);
|
10259
10256
|
this.$emit("shown");
|
10260
10257
|
});
|
10261
10258
|
} else {
|
10262
|
-
|
10263
|
-
|
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
|
-
|
10271
|
-
|
10272
|
-
|
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() {
|
@@ -16244,7 +16242,8 @@ const TABLE_ROW_ATTRIBUTE = {
|
|
16244
16242
|
ROW_SELECTION: "__row_selection",
|
16245
16243
|
ROW_SELECTION_ALL: "__row_selection_all",
|
16246
16244
|
ROW_SELECTION_INDETERMINATE: "__row_selection_indeterminate",
|
16247
|
-
ROW_SOURCE_DATA: "__row_source_data"
|
16245
|
+
ROW_SOURCE_DATA: "__row_source_data",
|
16246
|
+
ROW_SKIP_CFG: "__row_skip_config"
|
16248
16247
|
};
|
16249
16248
|
const COLUMN_ATTRIBUTE = {
|
16250
16249
|
COL_UID: "__col_$uuid"
|
@@ -16312,7 +16311,9 @@ const IColumnType = {
|
|
16312
16311
|
}),
|
16313
16312
|
PropTypes.bool,
|
16314
16313
|
PropTypes.string
|
16315
|
-
]).def(false)
|
16314
|
+
]).def(false),
|
16315
|
+
colspan: PropTypes.oneOfType([PropTypes.func.def(() => 1), PropTypes.number.def(1)]),
|
16316
|
+
rowspan: PropTypes.oneOfType([PropTypes.func.def(() => 1), PropTypes.number.def(1)])
|
16316
16317
|
};
|
16317
16318
|
const tableProps = {
|
16318
16319
|
data: PropTypes.arrayOf(PropTypes.any).def([]),
|
@@ -17180,6 +17181,28 @@ const isColumnHidden = (settingFields, column, checked) => {
|
|
17180
17181
|
const isSettingField = (col) => settingFields.some((field) => field.field === resolvePropVal(col, ["field", "type"], [col]));
|
17181
17182
|
return isSettingField(column) && checked.length && !checked.includes(resolvePropVal(column, ["field", "type"], [column]));
|
17182
17183
|
};
|
17184
|
+
const resolveColumnSpan = (column, colIndex, row, rowIndex, key2) => {
|
17185
|
+
if (typeof column[key2] === "function") {
|
17186
|
+
return Reflect.apply(column[key2], globalThis, [{
|
17187
|
+
column,
|
17188
|
+
colIndex,
|
17189
|
+
row,
|
17190
|
+
rowIndex
|
17191
|
+
}]);
|
17192
|
+
}
|
17193
|
+
if (typeof column[key2] === "number") {
|
17194
|
+
return column[key2];
|
17195
|
+
}
|
17196
|
+
return 1;
|
17197
|
+
};
|
17198
|
+
const resolveCellSpan = (column, colIndex, row, rowIndex) => {
|
17199
|
+
const colspan = resolveColumnSpan(column, colIndex, row, rowIndex, "colspan");
|
17200
|
+
const rowspan = resolveColumnSpan(column, colIndex, row, rowIndex, "rowspan");
|
17201
|
+
return {
|
17202
|
+
colspan,
|
17203
|
+
rowspan
|
17204
|
+
};
|
17205
|
+
};
|
17183
17206
|
var TableCell = defineComponent({
|
17184
17207
|
name: "TableCell",
|
17185
17208
|
props: {
|
@@ -17760,7 +17783,7 @@ var useFixedColumn = (props2, colgroups, hasScrollY) => {
|
|
17760
17783
|
let start2 = fixedPos === "right" ? length * opt : 1;
|
17761
17784
|
let preOffset = 0;
|
17762
17785
|
for (start2; ; ) {
|
17763
|
-
start2
|
17786
|
+
start2 = start2 + -1 * opt;
|
17764
17787
|
const index = Math.abs(start2);
|
17765
17788
|
const current = colgroups[index];
|
17766
17789
|
const curFixedPos = resolveFixColPos(current);
|
@@ -18072,6 +18095,7 @@ class TableRender {
|
|
18072
18095
|
const {
|
18073
18096
|
resolveFixedColumnStyle
|
18074
18097
|
} = useFixedColumn(this.props, this.colgroups);
|
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`
|
@@ -18087,30 +18111,45 @@ class TableRender {
|
|
18087
18111
|
"onClick": (e) => this.handleRowClick(e, row, rowIndex, rows),
|
18088
18112
|
"onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows)
|
18089
18113
|
}, [this.filterColgroups.map((column, index) => {
|
18090
|
-
|
18114
|
+
var _a, _b;
|
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
|
-
|
18101
|
-
|
18102
|
-
|
18103
|
-
|
18104
|
-
|
18105
|
-
|
18106
|
-
|
18107
|
-
|
18108
|
-
|
18109
|
-
|
18110
|
-
|
18111
|
-
|
18112
|
-
|
18113
|
-
|
18121
|
+
const {
|
18122
|
+
colspan,
|
18123
|
+
rowspan
|
18124
|
+
} = resolveCellSpan(column, index, row, rowIndex);
|
18125
|
+
const skipRowKey = TABLE_ROW_ATTRIBUTE.ROW_SKIP_CFG;
|
18126
|
+
const columnIdKey = column[COLUMN_ATTRIBUTE.COL_UID];
|
18127
|
+
const {
|
18128
|
+
skipRow = false,
|
18129
|
+
skipCol = false
|
18130
|
+
} = (_b = (_a = row[skipRowKey]) == null ? void 0 : _a[columnIdKey]) != null ? _b : {};
|
18131
|
+
if (!skipRow && !skipCol) {
|
18132
|
+
let _slot2;
|
18133
|
+
const cellClass = [this.getColumnClass(column, index), ...formatPropAsArray(this.props.cellClass, [column, index, row, rowIndex, this]), {
|
18134
|
+
"expand-row": row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND],
|
18135
|
+
"is-last": rowIndex + rowspan >= rowLength
|
18136
|
+
}];
|
18137
|
+
return createVNode("td", {
|
18138
|
+
"class": cellClass,
|
18139
|
+
"style": cellStyle,
|
18140
|
+
"key": cellKey,
|
18141
|
+
"colspan": colspan,
|
18142
|
+
"rowspan": rowspan
|
18143
|
+
}, [createVNode(TableCell, {
|
18144
|
+
"class": tdCtxClass,
|
18145
|
+
"column": column,
|
18146
|
+
"row": row,
|
18147
|
+
"parentSetting": this.props.showOverflowTooltip
|
18148
|
+
}, _isSlot$1(_slot2 = this.renderCell(row, column, rowIndex, rows)) ? _slot2 : {
|
18149
|
+
default: () => [_slot2]
|
18150
|
+
})]);
|
18151
|
+
}
|
18152
|
+
return null;
|
18114
18153
|
})])]
|
18115
18154
|
}), this.renderExpandRow(row, rowClass)];
|
18116
18155
|
})]);
|
@@ -18700,30 +18739,84 @@ const useInit = (props2, targetColumns) => {
|
|
18700
18739
|
return false;
|
18701
18740
|
});
|
18702
18741
|
const indexData = reactive([]);
|
18742
|
+
const neepColspanOrRowspan = computed(() => colgroups.some((col) => typeof col.rowspan === "function" || /^\d$/.test(`${col.rowspan}`) || typeof col.colspan === "function" || /^\d$/.test(`${col.colspan}`)));
|
18703
18743
|
const initIndexData = (keepLocalAction = false) => {
|
18744
|
+
let preRowId = null;
|
18745
|
+
const skipConfig = {};
|
18704
18746
|
indexData.splice(0, indexData.length, ...props2.data.map((item, index) => {
|
18705
18747
|
const rowId = getRowKey(item, props2, index);
|
18748
|
+
const cfg = neepColspanOrRowspan.value ? getSkipConfig(item, rowId, index, skipConfig, preRowId) : {};
|
18749
|
+
preRowId = rowId;
|
18706
18750
|
return __spreadProps(__spreadValues({}, item), {
|
18707
18751
|
[TABLE_ROW_ATTRIBUTE.ROW_INDEX]: index,
|
18708
18752
|
[TABLE_ROW_ATTRIBUTE.ROW_UID]: rowId,
|
18709
18753
|
[TABLE_ROW_ATTRIBUTE.ROW_EXPAND]: keepLocalAction ? isRowExpand(rowId) : false,
|
18710
18754
|
[TABLE_ROW_ATTRIBUTE.ROW_SELECTION]: resolveSelection(item, rowId),
|
18711
|
-
[TABLE_ROW_ATTRIBUTE.ROW_SOURCE_DATA]: __spreadValues({}, item)
|
18755
|
+
[TABLE_ROW_ATTRIBUTE.ROW_SOURCE_DATA]: __spreadValues({}, item),
|
18756
|
+
[TABLE_ROW_ATTRIBUTE.ROW_SKIP_CFG]: cfg
|
18712
18757
|
});
|
18713
18758
|
}));
|
18714
18759
|
initSelectionAllByData();
|
18715
18760
|
};
|
18716
18761
|
const updateIndexData = (selectedAll) => {
|
18717
|
-
|
18762
|
+
let preRowId = null;
|
18763
|
+
const skipConfig = {};
|
18764
|
+
indexData.forEach((item, index) => {
|
18765
|
+
const rowId = item[TABLE_ROW_ATTRIBUTE.ROW_UID];
|
18766
|
+
const cfg = neepColspanOrRowspan.value ? getSkipConfig(item, rowId, index, skipConfig, preRowId) : {};
|
18718
18767
|
Object.assign(item, {
|
18719
18768
|
[TABLE_ROW_ATTRIBUTE.ROW_EXPAND]: isRowExpand(item[TABLE_ROW_ATTRIBUTE.ROW_UID]),
|
18720
|
-
[TABLE_ROW_ATTRIBUTE.ROW_SELECTION]: typeof selectedAll === "boolean" ? selectedAll : resolveSelection(item, item[TABLE_ROW_ATTRIBUTE.ROW_UID])
|
18769
|
+
[TABLE_ROW_ATTRIBUTE.ROW_SELECTION]: typeof selectedAll === "boolean" ? selectedAll : resolveSelection(item, item[TABLE_ROW_ATTRIBUTE.ROW_UID]),
|
18770
|
+
[TABLE_ROW_ATTRIBUTE.ROW_SKIP_CFG]: cfg
|
18721
18771
|
});
|
18772
|
+
preRowId = item[TABLE_ROW_ATTRIBUTE.ROW_UID];
|
18722
18773
|
});
|
18723
18774
|
if (typeof selectedAll !== "boolean") {
|
18724
18775
|
initSelectionAllByData();
|
18725
18776
|
}
|
18726
18777
|
};
|
18778
|
+
const getSkipConfig = (row, rowId, rowIndex, skipCfg, preRowId) => {
|
18779
|
+
var _a2;
|
18780
|
+
let skipColumnNum = 0;
|
18781
|
+
const preRowConfig = (_a2 = skipCfg[preRowId]) != null ? _a2 : {};
|
18782
|
+
if (!skipCfg[rowId]) {
|
18783
|
+
skipCfg[rowId] = {};
|
18784
|
+
}
|
18785
|
+
colgroups.forEach((column, index) => {
|
18786
|
+
var _a3, _b2;
|
18787
|
+
const { colspan, rowspan } = resolveCellSpan(column, index, row, rowIndex);
|
18788
|
+
const colId = column[COLUMN_ATTRIBUTE.COL_UID];
|
18789
|
+
const preRowColSkipLen = (_b2 = (_a3 = preRowConfig[colId]) == null ? void 0 : _a3.skipRowLen) != null ? _b2 : 0;
|
18790
|
+
const target = {
|
18791
|
+
[colId]: {
|
18792
|
+
skipRowLen: 0,
|
18793
|
+
skipRow: false,
|
18794
|
+
skipCol: false,
|
18795
|
+
skipColLen: 0
|
18796
|
+
}
|
18797
|
+
};
|
18798
|
+
if (skipColumnNum > 0) {
|
18799
|
+
target[colId].skipColLen = skipColumnNum;
|
18800
|
+
target[colId].skipCol = true;
|
18801
|
+
skipColumnNum = skipColumnNum - 1;
|
18802
|
+
}
|
18803
|
+
if (preRowColSkipLen > 1) {
|
18804
|
+
target[colId].skipRowLen = preRowColSkipLen - 1;
|
18805
|
+
target[colId].skipRow = true;
|
18806
|
+
} else {
|
18807
|
+
if (rowspan > 1) {
|
18808
|
+
target[colId].skipRowLen = rowspan;
|
18809
|
+
target[colId].skipRow = false;
|
18810
|
+
}
|
18811
|
+
}
|
18812
|
+
if (colspan > 1) {
|
18813
|
+
target[colId].skipColLen = colspan;
|
18814
|
+
skipColumnNum = colspan - 1;
|
18815
|
+
}
|
18816
|
+
Object.assign(skipCfg[rowId], __spreadValues({}, target));
|
18817
|
+
});
|
18818
|
+
return skipCfg[rowId];
|
18819
|
+
};
|
18727
18820
|
const asyncSelection = (row, value, all = false) => {
|
18728
18821
|
if (props2.asyncData && props2.rowKey) {
|
18729
18822
|
if (all) {
|