bkui-vue 0.0.1-beta.344 → 0.0.1-beta.345
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 +40 -34
- package/dist/index.esm.js +115 -30
- package/dist/index.umd.js +39 -33
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/exception/index.js +1 -1
- package/lib/shared/index.js +1 -1
- package/lib/shared/utils.d.ts +6 -0
- package/lib/tab/index.js +1 -1
- package/lib/tab/tab.css +1 -0
- package/lib/tab/tab.less +26 -27
- package/lib/tab/tab.variable.css +1 -0
- package/lib/table/index.js +1 -1
- package/lib/table/table.css +6 -0
- package/lib/table/table.less +4 -0
- package/lib/table/table.variable.css +6 -0
- package/lib/tag-input/index.d.ts +20 -1
- package/lib/tag-input/index.js +1 -1
- package/lib/tag-input/tag-input.d.ts +11 -28
- package/lib/tag-input/tag-props.d.ts +5 -0
- package/lib/tag-input/tag-render.d.ts +30 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -7354,6 +7354,41 @@ const observerResize$1 = (root, callbackFn, delay = 60, immediate = false) => {
|
|
7354
7354
|
};
|
7355
7355
|
};
|
7356
7356
|
const capitalize = (str) => str[0].toUpperCase() + str.slice(1);
|
7357
|
+
function checkOverflow(el) {
|
7358
|
+
if (!el)
|
7359
|
+
return false;
|
7360
|
+
const createDom = (el2, css) => {
|
7361
|
+
const dom = document.createElement("div");
|
7362
|
+
const width = parseFloat(css.width) ? `${Math.ceil(parseFloat(css.width))}px` : css.width;
|
7363
|
+
dom.style.cssText = `
|
7364
|
+
width: ${width};
|
7365
|
+
line-height: ${css["line-height"]};
|
7366
|
+
font-size: ${css["font-size"]};
|
7367
|
+
word-break: ${css["word-break"]};
|
7368
|
+
padding: ${css.padding};
|
7369
|
+
`;
|
7370
|
+
dom.textContent = el2.textContent;
|
7371
|
+
return dom;
|
7372
|
+
};
|
7373
|
+
let isOverflow = false;
|
7374
|
+
try {
|
7375
|
+
const css = window.getComputedStyle(el, null);
|
7376
|
+
const lineClamp = css.webkitLineClamp;
|
7377
|
+
if (lineClamp !== "none") {
|
7378
|
+
const targetHeight = parseFloat(css.height);
|
7379
|
+
const dom = createDom(el, css);
|
7380
|
+
document.body.appendChild(dom);
|
7381
|
+
const domHeight = window.getComputedStyle(dom, null).height;
|
7382
|
+
document.body.removeChild(dom);
|
7383
|
+
isOverflow = targetHeight < parseFloat(domHeight);
|
7384
|
+
} else {
|
7385
|
+
isOverflow = el.clientWidth < el.scrollWidth || el.clientHeight < el.scrollHeight;
|
7386
|
+
}
|
7387
|
+
} catch (e) {
|
7388
|
+
console.warn("There is an error when check element overflow state: ", e);
|
7389
|
+
}
|
7390
|
+
return isOverflow;
|
7391
|
+
}
|
7357
7392
|
class BkMaskManager {
|
7358
7393
|
constructor(config) {
|
7359
7394
|
this.multiInstance = false;
|
@@ -10742,6 +10777,11 @@ var Component$t = defineComponent({
|
|
10742
10777
|
login
|
10743
10778
|
};
|
10744
10779
|
const renderImg = () => {
|
10780
|
+
if (_$1.isFunction(slots.type)) {
|
10781
|
+
return createVNode("div", {
|
10782
|
+
"class": "bk-exception-img"
|
10783
|
+
}, [slots.type()]);
|
10784
|
+
}
|
10745
10785
|
const imgSrc = images[props2.type] ? images[props2.type] : empty;
|
10746
10786
|
return createVNode("div", {
|
10747
10787
|
"class": "bk-exception-img"
|
@@ -17299,8 +17339,8 @@ const getSortFn = (column, sortType) => {
|
|
17299
17339
|
const fieldName = column.field;
|
17300
17340
|
const getVal = (row) => getRowText(row, fieldName, column);
|
17301
17341
|
const sortFn0 = (a2, b2) => {
|
17302
|
-
const val0 = getVal(a2);
|
17303
|
-
const val1 = getVal(b2);
|
17342
|
+
const val0 = getVal(a2) || "";
|
17343
|
+
const val1 = getVal(b2) || "";
|
17304
17344
|
if (typeof val0 === "number" && typeof val1 === "number") {
|
17305
17345
|
return val0 - val1;
|
17306
17346
|
}
|
@@ -17347,7 +17387,7 @@ const isRowSelectEnable = (props2, {
|
|
17347
17387
|
isCheckAll
|
17348
17388
|
}) => {
|
17349
17389
|
if (typeof props2.isRowSelectEnable === "boolean") {
|
17350
|
-
return props2.isRowSelectEnable;
|
17390
|
+
return props2.isRowSelectEnable !== false;
|
17351
17391
|
}
|
17352
17392
|
if (typeof props2.isRowSelectEnable === "function") {
|
17353
17393
|
return props2.isRowSelectEnable({
|
@@ -17461,7 +17501,7 @@ var TableCell = defineComponent({
|
|
17461
17501
|
return () => {
|
17462
17502
|
var _a;
|
17463
17503
|
return createVNode("div", {
|
17464
|
-
"class": "cell",
|
17504
|
+
"class": ["cell", props2.column.type],
|
17465
17505
|
"ref": refRoot,
|
17466
17506
|
"title": props2.title
|
17467
17507
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
@@ -18291,7 +18331,6 @@ class TableRender {
|
|
18291
18331
|
var _a, _b;
|
18292
18332
|
const cellStyle = [resolveFixedColumnStyle(column), ...formatPropAsArray(this.props.cellStyle, [column, index, row, rowIndex, this])];
|
18293
18333
|
const tdCtxClass = {
|
18294
|
-
cell: true,
|
18295
18334
|
"expand-cell": column.type === "expand"
|
18296
18335
|
};
|
18297
18336
|
const cellKey = `__CELL_${rowIndex}_${index}`;
|
@@ -18899,7 +18938,6 @@ const useInit = (props2, targetColumns) => {
|
|
18899
18938
|
hasChecked = true;
|
18900
18939
|
}
|
18901
18940
|
});
|
18902
|
-
reactiveSchema.rowActions.set(TABLE_ROW_ATTRIBUTE.ROW_SELECTION_ALL, hasChecked && !hasUnchecked);
|
18903
18941
|
reactiveSchema.rowActions.set(TABLE_ROW_ATTRIBUTE.ROW_SELECTION_INDETERMINATE, hasChecked && hasUnchecked);
|
18904
18942
|
};
|
18905
18943
|
const isSelectionEnable = () => props2.columns.some((col) => col.type === "selection");
|
@@ -18912,12 +18950,15 @@ const useInit = (props2, targetColumns) => {
|
|
18912
18950
|
const isChecked = typeof checked === "boolean" ? checked : !isSelectionAll();
|
18913
18951
|
reactiveSchema.rowActions.set(TABLE_ROW_ATTRIBUTE.ROW_SELECTION_ALL, isChecked);
|
18914
18952
|
reactiveSchema.rowActions.set(TABLE_ROW_ATTRIBUTE.ROW_SELECTION_INDETERMINATE, false);
|
18915
|
-
indexData.forEach((row) => {
|
18953
|
+
indexData.forEach((row, index) => {
|
18916
18954
|
var _a2;
|
18917
|
-
|
18918
|
-
|
18919
|
-
|
18955
|
+
if (isRowSelectEnable(props2, { row, index, isCheckAll: false })) {
|
18956
|
+
const rowId = row[TABLE_ROW_ATTRIBUTE.ROW_UID];
|
18957
|
+
const target = Object.assign({}, (_a2 = reactiveSchema.rowActions.get(rowId)) != null ? _a2 : {}, { isSelected: isChecked });
|
18958
|
+
reactiveSchema.rowActions.set(rowId, target);
|
18959
|
+
}
|
18920
18960
|
});
|
18961
|
+
updateSelectionAll();
|
18921
18962
|
updateIndexData(isChecked);
|
18922
18963
|
asyncSelection(null, checked, true);
|
18923
18964
|
};
|
@@ -18948,10 +18989,10 @@ const useInit = (props2, targetColumns) => {
|
|
18948
18989
|
}
|
18949
18990
|
return thenFn(row);
|
18950
18991
|
};
|
18951
|
-
const resolveSelection = (row, _rowId) => resolveSelectionRow(row, () => {
|
18992
|
+
const resolveSelection = (row, _rowId, index) => resolveSelectionRow(row, () => {
|
18952
18993
|
var _a2;
|
18953
18994
|
const rowId = _rowId === void 0 ? row[TABLE_ROW_ATTRIBUTE.ROW_UID] : _rowId;
|
18954
|
-
if (isSelectionAll()) {
|
18995
|
+
if (isRowSelectEnable(props2, { row, index, isCheckAll: false }) && isSelectionAll()) {
|
18955
18996
|
return true;
|
18956
18997
|
}
|
18957
18998
|
if (reactiveSchema.rowActions.has(rowId)) {
|
@@ -18972,22 +19013,30 @@ const useInit = (props2, targetColumns) => {
|
|
18972
19013
|
[TABLE_ROW_ATTRIBUTE.ROW_INDEX]: index,
|
18973
19014
|
[TABLE_ROW_ATTRIBUTE.ROW_UID]: rowId,
|
18974
19015
|
[TABLE_ROW_ATTRIBUTE.ROW_EXPAND]: keepLocalAction ? isRowExpand(rowId) : false,
|
18975
|
-
[TABLE_ROW_ATTRIBUTE.ROW_SELECTION]: resolveSelection(item, rowId),
|
19016
|
+
[TABLE_ROW_ATTRIBUTE.ROW_SELECTION]: resolveSelection(item, rowId, index),
|
18976
19017
|
[TABLE_ROW_ATTRIBUTE.ROW_SOURCE_DATA]: __spreadValues({}, item),
|
18977
19018
|
[TABLE_ROW_ATTRIBUTE.ROW_SKIP_CFG]: cfg
|
18978
19019
|
});
|
18979
19020
|
}));
|
18980
19021
|
initSelectionAllByData();
|
18981
19022
|
};
|
19023
|
+
const isRowChecked = (isRowCheckEnable, selectedAll, item, index) => {
|
19024
|
+
const isChecked = resolveSelection(item, item[TABLE_ROW_ATTRIBUTE.ROW_UID], index);
|
19025
|
+
if (isRowCheckEnable) {
|
19026
|
+
return typeof selectedAll === "boolean" ? selectedAll : isChecked;
|
19027
|
+
}
|
19028
|
+
return isChecked;
|
19029
|
+
};
|
18982
19030
|
const updateIndexData = (selectedAll) => {
|
18983
19031
|
let preRowId = null;
|
18984
19032
|
const skipConfig = {};
|
18985
19033
|
indexData.forEach((item, index) => {
|
18986
19034
|
const rowId = item[TABLE_ROW_ATTRIBUTE.ROW_UID];
|
18987
19035
|
const cfg = neepColspanOrRowspan.value ? getSkipConfig(item, rowId, index, skipConfig, preRowId) : {};
|
19036
|
+
const isRowCheckEnable = isRowSelectEnable(props2, { row: item, index, isCheckAll: false });
|
18988
19037
|
Object.assign(item, {
|
18989
19038
|
[TABLE_ROW_ATTRIBUTE.ROW_EXPAND]: isRowExpand(item[TABLE_ROW_ATTRIBUTE.ROW_UID]),
|
18990
|
-
[TABLE_ROW_ATTRIBUTE.ROW_SELECTION]:
|
19039
|
+
[TABLE_ROW_ATTRIBUTE.ROW_SELECTION]: isRowChecked(isRowCheckEnable, selectedAll, item, index),
|
18991
19040
|
[TABLE_ROW_ATTRIBUTE.ROW_SKIP_CFG]: cfg
|
18992
19041
|
});
|
18993
19042
|
preRowId = item[TABLE_ROW_ATTRIBUTE.ROW_UID];
|
@@ -19577,26 +19626,60 @@ const tagProps = () => ({
|
|
19577
19626
|
collapseTags: {
|
19578
19627
|
type: Boolean,
|
19579
19628
|
default: false
|
19629
|
+
},
|
19630
|
+
tagOverflowTips: {
|
19631
|
+
type: Object,
|
19632
|
+
default: () => ({})
|
19580
19633
|
}
|
19581
19634
|
});
|
19582
19635
|
var TagRender = defineComponent({
|
19583
19636
|
name: "TagRender",
|
19637
|
+
directives: {
|
19638
|
+
bkTooltips: tooltips
|
19639
|
+
},
|
19584
19640
|
props: {
|
19585
19641
|
node: PropTypes.object,
|
19586
19642
|
displayKey: PropTypes.string,
|
19587
19643
|
tpl: {
|
19588
19644
|
type: Function
|
19645
|
+
},
|
19646
|
+
hasTips: {
|
19647
|
+
type: Boolean,
|
19648
|
+
default: false
|
19649
|
+
},
|
19650
|
+
tagOverflowTips: {
|
19651
|
+
type: Object,
|
19652
|
+
default: () => ({})
|
19589
19653
|
}
|
19590
19654
|
},
|
19655
|
+
setup(props2) {
|
19656
|
+
const tagRef = ref();
|
19657
|
+
const isOverflow = ref(false);
|
19658
|
+
const overflowTips = computed(() => __spreadValues({
|
19659
|
+
boundary: "window",
|
19660
|
+
theme: "light",
|
19661
|
+
distance: 12,
|
19662
|
+
content: props2.node[props2.displayKey],
|
19663
|
+
disabled: props2.hasTips || !isOverflow.value
|
19664
|
+
}, props2.tagOverflowTips));
|
19665
|
+
onMounted(() => {
|
19666
|
+
isOverflow.value = checkOverflow(tagRef.value);
|
19667
|
+
});
|
19668
|
+
return {
|
19669
|
+
overflowTips,
|
19670
|
+
tagRef
|
19671
|
+
};
|
19672
|
+
},
|
19591
19673
|
render() {
|
19592
19674
|
if (this.tpl) {
|
19593
19675
|
return this.tpl(this.node, h$1, this);
|
19594
19676
|
}
|
19595
|
-
return createVNode("div", {
|
19596
|
-
"class": "tag"
|
19677
|
+
return withDirectives(createVNode("div", {
|
19678
|
+
"class": "tag",
|
19679
|
+
"ref": "tagRef"
|
19597
19680
|
}, [createVNode("span", {
|
19598
19681
|
"class": "text"
|
19599
|
-
}, [this.node[this.displayKey]])]);
|
19682
|
+
}, [this.node[this.displayKey]])]), [[resolveDirective("bk-tooltips"), this.overflowTips]]);
|
19600
19683
|
}
|
19601
19684
|
});
|
19602
19685
|
var Component$d = defineComponent({
|
@@ -20068,7 +20151,7 @@ var Component$d = defineComponent({
|
|
20068
20151
|
case "NumpadEnter":
|
20069
20152
|
if (!props2.allowCreate && popoverProps.isShow || props2.allowCreate && state.focusItemIndex >= 0 && popoverProps.isShow) {
|
20070
20153
|
handleTagSelected(pageState.curPageList[state.focusItemIndex], "select", e);
|
20071
|
-
} else if (props2.allowCreate) {
|
20154
|
+
} else if (props2.allowCreate && curInputValue.value.trim()) {
|
20072
20155
|
handleTagSelected(curInputValue.value, "custom", e);
|
20073
20156
|
}
|
20074
20157
|
e.preventDefault();
|
@@ -20308,7 +20391,9 @@ var Component$d = defineComponent({
|
|
20308
20391
|
}, [createVNode(TagRender, {
|
20309
20392
|
"node": item,
|
20310
20393
|
"tpl": this.tagTpl,
|
20311
|
-
"displayKey": this.displayKey
|
20394
|
+
"displayKey": this.displayKey,
|
20395
|
+
"hasTips": !!this.tooltipKey,
|
20396
|
+
"tagOverflowTips": this.tagOverflowTips
|
20312
20397
|
}, null), this.showTagClose ? createVNode(error, {
|
20313
20398
|
"class": "remove-tag",
|
20314
20399
|
"onClick": this.handleTagRemove.bind(this, item, index)
|
@@ -20616,12 +20701,12 @@ var TabNav = defineComponent({
|
|
20616
20701
|
tabLabel
|
20617
20702
|
} = item;
|
20618
20703
|
const getNavItemClass = () => {
|
20619
|
-
const classNames = ["
|
20704
|
+
const classNames = [resolveClassName("tab-header-item")];
|
20620
20705
|
if (disabled) {
|
20621
|
-
classNames.push("
|
20706
|
+
classNames.push(resolveClassName("tab-header--disabled"));
|
20622
20707
|
}
|
20623
20708
|
if (active === name) {
|
20624
|
-
classNames.push("
|
20709
|
+
classNames.push(resolveClassName("tab-header--active"));
|
20625
20710
|
}
|
20626
20711
|
return classNames.join(" ");
|
20627
20712
|
};
|
@@ -20651,7 +20736,7 @@ var TabNav = defineComponent({
|
|
20651
20736
|
},
|
20652
20737
|
"class": getNavItemClass()
|
20653
20738
|
}, [createVNode("div", null, [tabLabel]), getValue(item.closable, closable) && createVNode(close$1, {
|
20654
|
-
"class": "
|
20739
|
+
"class": resolveClassName("tab-header-item-close"),
|
20655
20740
|
"onClick": () => this.handleTabRemove(index, item)
|
20656
20741
|
}, null)]);
|
20657
20742
|
});
|
@@ -20670,9 +20755,9 @@ var TabNav = defineComponent({
|
|
20670
20755
|
}
|
20671
20756
|
if (list.length) {
|
20672
20757
|
return createVNode("div", {
|
20673
|
-
"class": "
|
20758
|
+
"class": resolveClassName("tab-header-operation")
|
20674
20759
|
}, [list.map((item, index) => createVNode("div", {
|
20675
|
-
"class": "
|
20760
|
+
"class": resolveClassName("tab-header-item"),
|
20676
20761
|
"key": index
|
20677
20762
|
}, [item]))]);
|
20678
20763
|
}
|
@@ -20682,11 +20767,11 @@ var TabNav = defineComponent({
|
|
20682
20767
|
"style": {
|
20683
20768
|
lineHeight: `${labelHeight}px`
|
20684
20769
|
},
|
20685
|
-
"class": "
|
20770
|
+
"class": resolveClassName("tab-header")
|
20686
20771
|
}, [createVNode("div", {
|
20687
|
-
"class": "
|
20772
|
+
"class": resolveClassName("tab-header-nav")
|
20688
20773
|
}, [renderNavs()]), renderSlot2(), typeof this.$slots.setting === "function" && createVNode("div", {
|
20689
|
-
"class": "
|
20774
|
+
"class": resolveClassName("tab-header-setting")
|
20690
20775
|
}, [this.$slots.setting()])]);
|
20691
20776
|
}
|
20692
20777
|
});
|
@@ -20861,7 +20946,7 @@ var Tab = defineComponent({
|
|
20861
20946
|
return createVNode("div", {
|
20862
20947
|
"class": getTabBoxClass()
|
20863
20948
|
}, [getTabHeader(), createVNode("div", {
|
20864
|
-
"class": "
|
20949
|
+
"class": resolveClassName("tab-content")
|
20865
20950
|
}, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)])]);
|
20866
20951
|
}
|
20867
20952
|
});
|
@@ -20887,7 +20972,7 @@ var TabPanel = defineComponent({
|
|
20887
20972
|
};
|
20888
20973
|
return withDirectives(createVNode("div", {
|
20889
20974
|
"ref": "content",
|
20890
|
-
"class": "
|
20975
|
+
"class": resolveClassName("tab-panel")
|
20891
20976
|
}, [getContent()]), [[vShow, active]]);
|
20892
20977
|
}
|
20893
20978
|
});
|