bkui-vue 0.0.1-beta.21 → 0.0.1-beta.22
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/bkui-vue.cjs.js +117 -31
- package/dist/bkui-vue.esm.js +117 -31
- package/dist/bkui-vue.umd.js +117 -31
- package/dist/style.css +17 -1
- package/lib/table/index.d.ts +24 -1
- package/lib/table/index.js +1 -1
- package/lib/table/props.d.ts +8 -0
- package/lib/table/render.d.ts +2 -0
- package/lib/table/table.css +8 -1
- package/lib/table/table.d.ts +11 -0
- package/lib/table/table.less +10 -1
- package/lib/table/table.variable.css +8 -1
- package/lib/tree/index.d.ts +39 -10
- package/lib/tree/index.js +1 -1
- package/lib/tree/props.d.ts +8 -0
- package/lib/tree/tree.css +9 -0
- package/lib/tree/tree.d.ts +22 -5
- package/lib/tree/tree.less +11 -0
- package/lib/tree/tree.variable.css +9 -0
- package/lib/tree/util.d.ts +11 -6
- package/package.json +1 -1
package/dist/bkui-vue.cjs.js
CHANGED
@@ -6003,7 +6003,8 @@ const tableProps = __spreadValues({
|
|
6003
6003
|
showHead: PropTypes.bool.def(true),
|
6004
6004
|
virtualEnabled: PropTypes.bool.def(false),
|
6005
6005
|
border: PropTypes.arrayOf(PropTypes.commonType(BORDER_OPRIONS, "border")).def(["row"]),
|
6006
|
-
pagination: PropTypes.oneOfType([PropTypes.bool.def(false), PropTypes.object.def({})]).def(false)
|
6006
|
+
pagination: PropTypes.oneOfType([PropTypes.bool.def(false), PropTypes.object.def({})]).def(false),
|
6007
|
+
remotePagination: PropTypes.bool.def(false)
|
6007
6008
|
}, EventProps$1);
|
6008
6009
|
const resolvePropVal = (prop, key, args) => {
|
6009
6010
|
if (Object.prototype.hasOwnProperty.call(prop, key)) {
|
@@ -6126,7 +6127,13 @@ const isPercentPixOrNumber = (val) => /^\d+\.?\d*(px|%)?$/.test(`${val}`);
|
|
6126
6127
|
const resolvePaginationOption = (propPagination, defVal) => {
|
6127
6128
|
if (!!propPagination) {
|
6128
6129
|
if (typeof propPagination === "object") {
|
6129
|
-
|
6130
|
+
let current = Object.prototype.hasOwnProperty.call(propPagination, "current") ? propPagination.current : propPagination.value;
|
6131
|
+
if (!/\d+/.test(current)) {
|
6132
|
+
current = 1;
|
6133
|
+
}
|
6134
|
+
return __spreadProps(__spreadValues(__spreadValues({}, defVal), propPagination), {
|
6135
|
+
current
|
6136
|
+
});
|
6130
6137
|
}
|
6131
6138
|
return defVal;
|
6132
6139
|
}
|
@@ -6606,7 +6613,24 @@ class TableRender {
|
|
6606
6613
|
}, [this.renderColGroup(), this.renderTBody(rows)]);
|
6607
6614
|
}
|
6608
6615
|
renderTableFooter(options) {
|
6609
|
-
return vue.createVNode(BkPagination, options,
|
6616
|
+
return vue.createVNode(BkPagination, vue.mergeProps(options, {
|
6617
|
+
"modelValue": options.current,
|
6618
|
+
"onLimitChange": (limit) => this.handlePageLimitChange(limit),
|
6619
|
+
"onChange": (current) => this.hanlePageChange(current)
|
6620
|
+
}), null);
|
6621
|
+
}
|
6622
|
+
handlePageLimitChange(limit) {
|
6623
|
+
Object.assign(this.props.pagination, {
|
6624
|
+
limit
|
6625
|
+
});
|
6626
|
+
this.context.emit("page-limit-change", limit);
|
6627
|
+
}
|
6628
|
+
hanlePageChange(current) {
|
6629
|
+
Object.assign(this.props.pagination, {
|
6630
|
+
current,
|
6631
|
+
value: current
|
6632
|
+
});
|
6633
|
+
this.context.emit("page-value-change", current);
|
6610
6634
|
}
|
6611
6635
|
setColumnActive(index, single = false) {
|
6612
6636
|
const col = this.propActiveCols.find((item) => item.index === index);
|
@@ -6946,11 +6970,24 @@ var Component$4 = vue.defineComponent({
|
|
6946
6970
|
const colgroups = vue.reactive(props.columns.map((col) => __spreadProps(__spreadValues({}, col), {
|
6947
6971
|
calcWidth: null
|
6948
6972
|
})));
|
6973
|
+
const startIndex = vue.ref(0);
|
6974
|
+
const endIndex = vue.ref(0);
|
6949
6975
|
let pagination2 = vue.reactive({
|
6950
6976
|
count: 0,
|
6951
6977
|
limit: 10,
|
6952
6978
|
current: 1
|
6953
6979
|
});
|
6980
|
+
pagination2 = resolvePaginationOption(props.pagination, pagination2);
|
6981
|
+
const resetStartEndIndex = () => {
|
6982
|
+
if (!props.pagination || props.remotePagination) {
|
6983
|
+
startIndex.value = 0;
|
6984
|
+
endIndex.value = props.data.length;
|
6985
|
+
return;
|
6986
|
+
}
|
6987
|
+
startIndex.value = (pagination2.current - 1) * pagination2.limit;
|
6988
|
+
endIndex.value = pagination2.current * pagination2.limit;
|
6989
|
+
};
|
6990
|
+
resetStartEndIndex();
|
6954
6991
|
let observerIns = null;
|
6955
6992
|
const root = vue.ref();
|
6956
6993
|
const getActiveColumns = () => (props.columns || []).map((_column, index) => ({
|
@@ -6962,21 +6999,6 @@ var Component$4 = vue.defineComponent({
|
|
6962
6999
|
activeColumns: getActiveColumns(),
|
6963
7000
|
scrollTranslateY: 0
|
6964
7001
|
});
|
6965
|
-
const wrapperStyle = vue.computed(() => ({
|
6966
|
-
minHeight: resolveNumberOrStringToPix(props.minHeight, "auto")
|
6967
|
-
}));
|
6968
|
-
const contentStyle = vue.computed(() => {
|
6969
|
-
const resolveHeight = resolveNumberOrStringToPix(props.height);
|
6970
|
-
const resolveHeadHeight = props.showHead ? resolveNumberOrStringToPix(props.headHeight) : "0";
|
6971
|
-
const isAutoHeight = !isPercentPixOrNumber(props.height);
|
6972
|
-
return __spreadValues({
|
6973
|
-
display: "block"
|
6974
|
-
}, isAutoHeight ? {
|
6975
|
-
maxHeight: `calc(${resolveHeight} - ${resolveHeadHeight} - 2px)`
|
6976
|
-
} : {
|
6977
|
-
height: `calc(${resolveHeight} - ${resolveHeadHeight} - 2px)`
|
6978
|
-
});
|
6979
|
-
});
|
6980
7002
|
vue.watch(() => [props.activeColumn, props.columns, props.pagination], () => {
|
6981
7003
|
vue.nextTick(() => {
|
6982
7004
|
reactiveProp.activeColumns = getActiveColumns();
|
@@ -6987,11 +7009,38 @@ var Component$4 = vue.defineComponent({
|
|
6987
7009
|
});
|
6988
7010
|
});
|
6989
7011
|
pagination2 = resolvePaginationOption(props.pagination, pagination2);
|
7012
|
+
resetStartEndIndex();
|
6990
7013
|
});
|
6991
7014
|
}, {
|
6992
7015
|
deep: true
|
6993
7016
|
});
|
6994
7017
|
const tableRender = new TableRender(props, ctx, reactiveProp, colgroups);
|
7018
|
+
const wrapperStyle = vue.computed(() => ({
|
7019
|
+
minHeight: resolveNumberOrStringToPix(props.minHeight, "auto")
|
7020
|
+
}));
|
7021
|
+
const pageData = vue.computed(() => props.data.slice(startIndex.value, endIndex.value));
|
7022
|
+
const localPagination = vue.computed(() => {
|
7023
|
+
if (!props.pagination) {
|
7024
|
+
return null;
|
7025
|
+
}
|
7026
|
+
return props.remotePagination ? pagination2 : __spreadProps(__spreadValues({}, pagination2), {
|
7027
|
+
count: props.data.length
|
7028
|
+
});
|
7029
|
+
});
|
7030
|
+
const contentStyle = vue.computed(() => {
|
7031
|
+
const resolveHeight = resolveNumberOrStringToPix(props.height);
|
7032
|
+
const resolveHeadHeight = props.showHead ? resolveNumberOrStringToPix(props.headHeight) : "0";
|
7033
|
+
const isAutoHeight = !isPercentPixOrNumber(props.height);
|
7034
|
+
const resolveFooterHeight = props.pagination ? 40 : 0;
|
7035
|
+
const contentHeight = `calc(${resolveHeight} - ${resolveHeadHeight} - ${resolveFooterHeight}px - 2px)`;
|
7036
|
+
return __spreadValues({
|
7037
|
+
display: "block"
|
7038
|
+
}, isAutoHeight ? {
|
7039
|
+
maxHeight: contentHeight
|
7040
|
+
} : {
|
7041
|
+
height: contentHeight
|
7042
|
+
});
|
7043
|
+
});
|
6995
7044
|
const tableClass = vue.computed(() => classes({
|
6996
7045
|
[resolveClassName("table")]: true
|
6997
7046
|
}, resolvePropBorderToClassStr(props.border)));
|
@@ -7029,9 +7078,9 @@ var Component$4 = vue.defineComponent({
|
|
7029
7078
|
"class": headClass
|
7030
7079
|
}, [props.showHead && tableRender.renderTableHeadSchema()]), vue.createVNode(BkVirtualRender, {
|
7031
7080
|
"lineHeight": props.rowHeight,
|
7032
|
-
"
|
7081
|
+
"class": contentClass,
|
7033
7082
|
"style": contentStyle.value,
|
7034
|
-
"list":
|
7083
|
+
"list": pageData.value,
|
7035
7084
|
"onContentScroll": handleScrollChanged,
|
7036
7085
|
"throttleDelay": 0,
|
7037
7086
|
"enabled": props.virtualEnabled
|
@@ -7042,7 +7091,7 @@ var Component$4 = vue.defineComponent({
|
|
7042
7091
|
}, null)
|
7043
7092
|
}), vue.createVNode("div", {
|
7044
7093
|
"class": footerClass
|
7045
|
-
}, [props.pagination && tableRender.renderTableFooter(
|
7094
|
+
}, [props.pagination && tableRender.renderTableFooter(localPagination.value)])]);
|
7046
7095
|
}
|
7047
7096
|
});
|
7048
7097
|
const BkTable = withInstall(Component$4);
|
@@ -12751,6 +12800,7 @@ const getFlatdata = (props, treeData = void 0, cachedSchema = []) => {
|
|
12751
12800
|
__isRoot: parent === null,
|
12752
12801
|
__order: order2,
|
12753
12802
|
__isOpen: isOpen,
|
12803
|
+
__checked: false,
|
12754
12804
|
[children]: null
|
12755
12805
|
};
|
12756
12806
|
Object.assign(item, { __uuid: uuid2 });
|
@@ -12809,15 +12859,14 @@ const getTreeStyle = (item, props) => {
|
|
12809
12859
|
"--level-line": levelLine,
|
12810
12860
|
"--lineHeight": `${props.lineHeight}px`,
|
12811
12861
|
"--indent": `${props.indent}px`,
|
12812
|
-
|
12862
|
+
"--offset-left": `${props.offsetLeft}px`
|
12813
12863
|
};
|
12814
12864
|
};
|
12815
12865
|
const getNodeItemStyle = (item, props, flatData = {}) => {
|
12816
12866
|
const { schema } = flatData;
|
12817
12867
|
const depth = getNodeAttr(schema, item.__uuid, "__depth");
|
12818
12868
|
return __spreadValues({
|
12819
|
-
"--depth": depth
|
12820
|
-
paddingLeft: 0
|
12869
|
+
"--depth": depth
|
12821
12870
|
}, typeof props.levelLine === "function" ? {
|
12822
12871
|
"--level-line": getPropsOneOfBoolValueWithDefault(props, "levelLine", item, DEFAULT_LEVLE_LINE, null, [
|
12823
12872
|
"node"
|
@@ -12834,6 +12883,13 @@ const getNodeItemClass = (item, schema, props) => {
|
|
12834
12883
|
"level-line": props.levelLine
|
12835
12884
|
};
|
12836
12885
|
};
|
12886
|
+
const getNodeRowClass = (item, schema) => {
|
12887
|
+
const { __checked } = getSchemaVal(schema, item.__uuid) || {};
|
12888
|
+
return {
|
12889
|
+
"is-checked": __checked,
|
12890
|
+
"bk-node-row": true
|
12891
|
+
};
|
12892
|
+
};
|
12837
12893
|
const updateTreeNode = (path, treeData, childKey, nodekey, nodeValue) => {
|
12838
12894
|
assignTreeNode(path, treeData, childKey, { [nodekey]: nodeValue });
|
12839
12895
|
};
|
@@ -12865,20 +12921,21 @@ const treeProps = {
|
|
12865
12921
|
async: PropTypes.shape({
|
12866
12922
|
callback: PropTypes.func.def(null),
|
12867
12923
|
cache: PropTypes.bool.def(true)
|
12868
|
-
})
|
12924
|
+
}),
|
12925
|
+
offsetLeft: PropTypes.number.def(15)
|
12869
12926
|
};
|
12870
12927
|
var Component = vue.defineComponent({
|
12871
12928
|
name: "Tree",
|
12872
12929
|
props: treeProps,
|
12873
|
-
setup(props) {
|
12930
|
+
setup(props, ctx) {
|
12874
12931
|
const formatData = getFlatdata(props);
|
12932
|
+
const checkedNodes = [];
|
12875
12933
|
const flatData = vue.reactive({
|
12876
12934
|
data: formatData[0],
|
12877
12935
|
schema: formatData[1],
|
12878
12936
|
levelLineSchema: {}
|
12879
12937
|
});
|
12880
12938
|
vue.watch(() => [props.data], (newData) => {
|
12881
|
-
console.log("props.data changed");
|
12882
12939
|
const formatData2 = getFlatdata(props, newData, schemaValues.value);
|
12883
12940
|
flatData.data = formatData2[0];
|
12884
12941
|
flatData.schema = formatData2[1];
|
@@ -12919,6 +12976,9 @@ var Component = vue.defineComponent({
|
|
12919
12976
|
return val;
|
12920
12977
|
}
|
12921
12978
|
if (typeof val === "object" && val !== null) {
|
12979
|
+
if (val.__v_isVNode) {
|
12980
|
+
return val;
|
12981
|
+
}
|
12922
12982
|
const {
|
12923
12983
|
node,
|
12924
12984
|
className,
|
@@ -12956,7 +13016,7 @@ var Component = vue.defineComponent({
|
|
12956
13016
|
}
|
12957
13017
|
}
|
12958
13018
|
if (prefixFnVal === "default" || typeof props.prefixIcon === "boolean" && props.prefixIcon) {
|
12959
|
-
return isRootNode(item) ? getRootIcon(item) : vue.createVNode(textFile, {
|
13019
|
+
return isRootNode(item) || hasChildNode(item) ? getRootIcon(item) : vue.createVNode(textFile, {
|
12960
13020
|
"class": "bk-tree-icon"
|
12961
13021
|
}, null);
|
12962
13022
|
}
|
@@ -13003,6 +13063,23 @@ var Component = vue.defineComponent({
|
|
13003
13063
|
setNodeOpened(item);
|
13004
13064
|
}
|
13005
13065
|
};
|
13066
|
+
const handleNodeActionClick = (node) => {
|
13067
|
+
hanldeTreeNodeClick(node);
|
13068
|
+
};
|
13069
|
+
const handleNodeContentClick = (item) => {
|
13070
|
+
if (!checkedNodes.includes(item.__uuid)) {
|
13071
|
+
checkedNodes.forEach((__uuid) => setNodeAttr({
|
13072
|
+
__uuid
|
13073
|
+
}, "__checked", false));
|
13074
|
+
checkedNodes.length = 0;
|
13075
|
+
setNodeAttr(item, "__checked", true);
|
13076
|
+
checkedNodes.push(item.__uuid);
|
13077
|
+
if (!isNodeOpened(item)) {
|
13078
|
+
hanldeTreeNodeClick(item);
|
13079
|
+
}
|
13080
|
+
ctx.emit("check", item, getSchemaVal2(item.__uuid));
|
13081
|
+
}
|
13082
|
+
};
|
13006
13083
|
const checkNodeIsOpen = (node) => isRootNode(node) || isItemOpen(node) || isItemOpen(getNodeAttr2(node, "__parentId"));
|
13007
13084
|
const filterNextNode = (depth, node) => {
|
13008
13085
|
if (isRootNode(node)) {
|
@@ -13037,6 +13114,8 @@ var Component = vue.defineComponent({
|
|
13037
13114
|
renderData,
|
13038
13115
|
flatData,
|
13039
13116
|
hanldeTreeNodeClick,
|
13117
|
+
handleNodeContentClick,
|
13118
|
+
handleNodeActionClick,
|
13040
13119
|
getActionIcon,
|
13041
13120
|
getRootIcon,
|
13042
13121
|
getVirtualLines,
|
@@ -13047,10 +13126,17 @@ var Component = vue.defineComponent({
|
|
13047
13126
|
render() {
|
13048
13127
|
const props = this.$props;
|
13049
13128
|
const renderTreeNode = (item) => vue.createVNode("div", {
|
13129
|
+
"class": getNodeRowClass(item, this.flatData.schema)
|
13130
|
+
}, [vue.createVNode("div", {
|
13050
13131
|
"class": getNodeItemClass(item, this.flatData.schema, props),
|
13051
|
-
"style": getNodeItemStyle(item, props, this.flatData)
|
13052
|
-
|
13053
|
-
|
13132
|
+
"style": getNodeItemStyle(item, props, this.flatData)
|
13133
|
+
}, [vue.createVNode("span", {
|
13134
|
+
"class": "node-action",
|
13135
|
+
"onClick": () => this.handleNodeActionClick(item)
|
13136
|
+
}, [this.getActionIcon(item)]), vue.createVNode("span", {
|
13137
|
+
"class": "node-content",
|
13138
|
+
"onClick": () => this.handleNodeContentClick(item)
|
13139
|
+
}, [[this.getNodePrefixIcon(item), this.getLoadingIcon(item)], vue.createVNode("span", null, [getLabel(item, props)])]), this.getVirtualLines(item)])]);
|
13054
13140
|
return vue.createVNode(BkVirtualRender, {
|
13055
13141
|
"class": "bk-tree",
|
13056
13142
|
"style": getTreeStyle(null, props),
|
package/dist/bkui-vue.esm.js
CHANGED
@@ -6001,7 +6001,8 @@ const tableProps = __spreadValues({
|
|
6001
6001
|
showHead: PropTypes.bool.def(true),
|
6002
6002
|
virtualEnabled: PropTypes.bool.def(false),
|
6003
6003
|
border: PropTypes.arrayOf(PropTypes.commonType(BORDER_OPRIONS, "border")).def(["row"]),
|
6004
|
-
pagination: PropTypes.oneOfType([PropTypes.bool.def(false), PropTypes.object.def({})]).def(false)
|
6004
|
+
pagination: PropTypes.oneOfType([PropTypes.bool.def(false), PropTypes.object.def({})]).def(false),
|
6005
|
+
remotePagination: PropTypes.bool.def(false)
|
6005
6006
|
}, EventProps$1);
|
6006
6007
|
const resolvePropVal = (prop, key, args) => {
|
6007
6008
|
if (Object.prototype.hasOwnProperty.call(prop, key)) {
|
@@ -6124,7 +6125,13 @@ const isPercentPixOrNumber = (val) => /^\d+\.?\d*(px|%)?$/.test(`${val}`);
|
|
6124
6125
|
const resolvePaginationOption = (propPagination, defVal) => {
|
6125
6126
|
if (!!propPagination) {
|
6126
6127
|
if (typeof propPagination === "object") {
|
6127
|
-
|
6128
|
+
let current = Object.prototype.hasOwnProperty.call(propPagination, "current") ? propPagination.current : propPagination.value;
|
6129
|
+
if (!/\d+/.test(current)) {
|
6130
|
+
current = 1;
|
6131
|
+
}
|
6132
|
+
return __spreadProps(__spreadValues(__spreadValues({}, defVal), propPagination), {
|
6133
|
+
current
|
6134
|
+
});
|
6128
6135
|
}
|
6129
6136
|
return defVal;
|
6130
6137
|
}
|
@@ -6604,7 +6611,24 @@ class TableRender {
|
|
6604
6611
|
}, [this.renderColGroup(), this.renderTBody(rows)]);
|
6605
6612
|
}
|
6606
6613
|
renderTableFooter(options) {
|
6607
|
-
return createVNode(BkPagination, options,
|
6614
|
+
return createVNode(BkPagination, mergeProps(options, {
|
6615
|
+
"modelValue": options.current,
|
6616
|
+
"onLimitChange": (limit) => this.handlePageLimitChange(limit),
|
6617
|
+
"onChange": (current) => this.hanlePageChange(current)
|
6618
|
+
}), null);
|
6619
|
+
}
|
6620
|
+
handlePageLimitChange(limit) {
|
6621
|
+
Object.assign(this.props.pagination, {
|
6622
|
+
limit
|
6623
|
+
});
|
6624
|
+
this.context.emit("page-limit-change", limit);
|
6625
|
+
}
|
6626
|
+
hanlePageChange(current) {
|
6627
|
+
Object.assign(this.props.pagination, {
|
6628
|
+
current,
|
6629
|
+
value: current
|
6630
|
+
});
|
6631
|
+
this.context.emit("page-value-change", current);
|
6608
6632
|
}
|
6609
6633
|
setColumnActive(index, single = false) {
|
6610
6634
|
const col = this.propActiveCols.find((item) => item.index === index);
|
@@ -6944,11 +6968,24 @@ var Component$4 = defineComponent({
|
|
6944
6968
|
const colgroups = reactive(props.columns.map((col) => __spreadProps(__spreadValues({}, col), {
|
6945
6969
|
calcWidth: null
|
6946
6970
|
})));
|
6971
|
+
const startIndex = ref(0);
|
6972
|
+
const endIndex = ref(0);
|
6947
6973
|
let pagination2 = reactive({
|
6948
6974
|
count: 0,
|
6949
6975
|
limit: 10,
|
6950
6976
|
current: 1
|
6951
6977
|
});
|
6978
|
+
pagination2 = resolvePaginationOption(props.pagination, pagination2);
|
6979
|
+
const resetStartEndIndex = () => {
|
6980
|
+
if (!props.pagination || props.remotePagination) {
|
6981
|
+
startIndex.value = 0;
|
6982
|
+
endIndex.value = props.data.length;
|
6983
|
+
return;
|
6984
|
+
}
|
6985
|
+
startIndex.value = (pagination2.current - 1) * pagination2.limit;
|
6986
|
+
endIndex.value = pagination2.current * pagination2.limit;
|
6987
|
+
};
|
6988
|
+
resetStartEndIndex();
|
6952
6989
|
let observerIns = null;
|
6953
6990
|
const root = ref();
|
6954
6991
|
const getActiveColumns = () => (props.columns || []).map((_column, index) => ({
|
@@ -6960,21 +6997,6 @@ var Component$4 = defineComponent({
|
|
6960
6997
|
activeColumns: getActiveColumns(),
|
6961
6998
|
scrollTranslateY: 0
|
6962
6999
|
});
|
6963
|
-
const wrapperStyle = computed(() => ({
|
6964
|
-
minHeight: resolveNumberOrStringToPix(props.minHeight, "auto")
|
6965
|
-
}));
|
6966
|
-
const contentStyle = computed(() => {
|
6967
|
-
const resolveHeight = resolveNumberOrStringToPix(props.height);
|
6968
|
-
const resolveHeadHeight = props.showHead ? resolveNumberOrStringToPix(props.headHeight) : "0";
|
6969
|
-
const isAutoHeight = !isPercentPixOrNumber(props.height);
|
6970
|
-
return __spreadValues({
|
6971
|
-
display: "block"
|
6972
|
-
}, isAutoHeight ? {
|
6973
|
-
maxHeight: `calc(${resolveHeight} - ${resolveHeadHeight} - 2px)`
|
6974
|
-
} : {
|
6975
|
-
height: `calc(${resolveHeight} - ${resolveHeadHeight} - 2px)`
|
6976
|
-
});
|
6977
|
-
});
|
6978
7000
|
watch(() => [props.activeColumn, props.columns, props.pagination], () => {
|
6979
7001
|
nextTick(() => {
|
6980
7002
|
reactiveProp.activeColumns = getActiveColumns();
|
@@ -6985,11 +7007,38 @@ var Component$4 = defineComponent({
|
|
6985
7007
|
});
|
6986
7008
|
});
|
6987
7009
|
pagination2 = resolvePaginationOption(props.pagination, pagination2);
|
7010
|
+
resetStartEndIndex();
|
6988
7011
|
});
|
6989
7012
|
}, {
|
6990
7013
|
deep: true
|
6991
7014
|
});
|
6992
7015
|
const tableRender = new TableRender(props, ctx, reactiveProp, colgroups);
|
7016
|
+
const wrapperStyle = computed(() => ({
|
7017
|
+
minHeight: resolveNumberOrStringToPix(props.minHeight, "auto")
|
7018
|
+
}));
|
7019
|
+
const pageData = computed(() => props.data.slice(startIndex.value, endIndex.value));
|
7020
|
+
const localPagination = computed(() => {
|
7021
|
+
if (!props.pagination) {
|
7022
|
+
return null;
|
7023
|
+
}
|
7024
|
+
return props.remotePagination ? pagination2 : __spreadProps(__spreadValues({}, pagination2), {
|
7025
|
+
count: props.data.length
|
7026
|
+
});
|
7027
|
+
});
|
7028
|
+
const contentStyle = computed(() => {
|
7029
|
+
const resolveHeight = resolveNumberOrStringToPix(props.height);
|
7030
|
+
const resolveHeadHeight = props.showHead ? resolveNumberOrStringToPix(props.headHeight) : "0";
|
7031
|
+
const isAutoHeight = !isPercentPixOrNumber(props.height);
|
7032
|
+
const resolveFooterHeight = props.pagination ? 40 : 0;
|
7033
|
+
const contentHeight = `calc(${resolveHeight} - ${resolveHeadHeight} - ${resolveFooterHeight}px - 2px)`;
|
7034
|
+
return __spreadValues({
|
7035
|
+
display: "block"
|
7036
|
+
}, isAutoHeight ? {
|
7037
|
+
maxHeight: contentHeight
|
7038
|
+
} : {
|
7039
|
+
height: contentHeight
|
7040
|
+
});
|
7041
|
+
});
|
6993
7042
|
const tableClass = computed(() => classes({
|
6994
7043
|
[resolveClassName("table")]: true
|
6995
7044
|
}, resolvePropBorderToClassStr(props.border)));
|
@@ -7027,9 +7076,9 @@ var Component$4 = defineComponent({
|
|
7027
7076
|
"class": headClass
|
7028
7077
|
}, [props.showHead && tableRender.renderTableHeadSchema()]), createVNode(BkVirtualRender, {
|
7029
7078
|
"lineHeight": props.rowHeight,
|
7030
|
-
"
|
7079
|
+
"class": contentClass,
|
7031
7080
|
"style": contentStyle.value,
|
7032
|
-
"list":
|
7081
|
+
"list": pageData.value,
|
7033
7082
|
"onContentScroll": handleScrollChanged,
|
7034
7083
|
"throttleDelay": 0,
|
7035
7084
|
"enabled": props.virtualEnabled
|
@@ -7040,7 +7089,7 @@ var Component$4 = defineComponent({
|
|
7040
7089
|
}, null)
|
7041
7090
|
}), createVNode("div", {
|
7042
7091
|
"class": footerClass
|
7043
|
-
}, [props.pagination && tableRender.renderTableFooter(
|
7092
|
+
}, [props.pagination && tableRender.renderTableFooter(localPagination.value)])]);
|
7044
7093
|
}
|
7045
7094
|
});
|
7046
7095
|
const BkTable = withInstall(Component$4);
|
@@ -12749,6 +12798,7 @@ const getFlatdata = (props, treeData = void 0, cachedSchema = []) => {
|
|
12749
12798
|
__isRoot: parent === null,
|
12750
12799
|
__order: order2,
|
12751
12800
|
__isOpen: isOpen,
|
12801
|
+
__checked: false,
|
12752
12802
|
[children]: null
|
12753
12803
|
};
|
12754
12804
|
Object.assign(item, { __uuid: uuid2 });
|
@@ -12807,15 +12857,14 @@ const getTreeStyle = (item, props) => {
|
|
12807
12857
|
"--level-line": levelLine,
|
12808
12858
|
"--lineHeight": `${props.lineHeight}px`,
|
12809
12859
|
"--indent": `${props.indent}px`,
|
12810
|
-
|
12860
|
+
"--offset-left": `${props.offsetLeft}px`
|
12811
12861
|
};
|
12812
12862
|
};
|
12813
12863
|
const getNodeItemStyle = (item, props, flatData = {}) => {
|
12814
12864
|
const { schema } = flatData;
|
12815
12865
|
const depth = getNodeAttr(schema, item.__uuid, "__depth");
|
12816
12866
|
return __spreadValues({
|
12817
|
-
"--depth": depth
|
12818
|
-
paddingLeft: 0
|
12867
|
+
"--depth": depth
|
12819
12868
|
}, typeof props.levelLine === "function" ? {
|
12820
12869
|
"--level-line": getPropsOneOfBoolValueWithDefault(props, "levelLine", item, DEFAULT_LEVLE_LINE, null, [
|
12821
12870
|
"node"
|
@@ -12832,6 +12881,13 @@ const getNodeItemClass = (item, schema, props) => {
|
|
12832
12881
|
"level-line": props.levelLine
|
12833
12882
|
};
|
12834
12883
|
};
|
12884
|
+
const getNodeRowClass = (item, schema) => {
|
12885
|
+
const { __checked } = getSchemaVal(schema, item.__uuid) || {};
|
12886
|
+
return {
|
12887
|
+
"is-checked": __checked,
|
12888
|
+
"bk-node-row": true
|
12889
|
+
};
|
12890
|
+
};
|
12835
12891
|
const updateTreeNode = (path, treeData, childKey, nodekey, nodeValue) => {
|
12836
12892
|
assignTreeNode(path, treeData, childKey, { [nodekey]: nodeValue });
|
12837
12893
|
};
|
@@ -12863,20 +12919,21 @@ const treeProps = {
|
|
12863
12919
|
async: PropTypes.shape({
|
12864
12920
|
callback: PropTypes.func.def(null),
|
12865
12921
|
cache: PropTypes.bool.def(true)
|
12866
|
-
})
|
12922
|
+
}),
|
12923
|
+
offsetLeft: PropTypes.number.def(15)
|
12867
12924
|
};
|
12868
12925
|
var Component = defineComponent({
|
12869
12926
|
name: "Tree",
|
12870
12927
|
props: treeProps,
|
12871
|
-
setup(props) {
|
12928
|
+
setup(props, ctx) {
|
12872
12929
|
const formatData = getFlatdata(props);
|
12930
|
+
const checkedNodes = [];
|
12873
12931
|
const flatData = reactive({
|
12874
12932
|
data: formatData[0],
|
12875
12933
|
schema: formatData[1],
|
12876
12934
|
levelLineSchema: {}
|
12877
12935
|
});
|
12878
12936
|
watch(() => [props.data], (newData) => {
|
12879
|
-
console.log("props.data changed");
|
12880
12937
|
const formatData2 = getFlatdata(props, newData, schemaValues.value);
|
12881
12938
|
flatData.data = formatData2[0];
|
12882
12939
|
flatData.schema = formatData2[1];
|
@@ -12917,6 +12974,9 @@ var Component = defineComponent({
|
|
12917
12974
|
return val;
|
12918
12975
|
}
|
12919
12976
|
if (typeof val === "object" && val !== null) {
|
12977
|
+
if (val.__v_isVNode) {
|
12978
|
+
return val;
|
12979
|
+
}
|
12920
12980
|
const {
|
12921
12981
|
node,
|
12922
12982
|
className,
|
@@ -12954,7 +13014,7 @@ var Component = defineComponent({
|
|
12954
13014
|
}
|
12955
13015
|
}
|
12956
13016
|
if (prefixFnVal === "default" || typeof props.prefixIcon === "boolean" && props.prefixIcon) {
|
12957
|
-
return isRootNode(item) ? getRootIcon(item) : createVNode(textFile, {
|
13017
|
+
return isRootNode(item) || hasChildNode(item) ? getRootIcon(item) : createVNode(textFile, {
|
12958
13018
|
"class": "bk-tree-icon"
|
12959
13019
|
}, null);
|
12960
13020
|
}
|
@@ -13001,6 +13061,23 @@ var Component = defineComponent({
|
|
13001
13061
|
setNodeOpened(item);
|
13002
13062
|
}
|
13003
13063
|
};
|
13064
|
+
const handleNodeActionClick = (node) => {
|
13065
|
+
hanldeTreeNodeClick(node);
|
13066
|
+
};
|
13067
|
+
const handleNodeContentClick = (item) => {
|
13068
|
+
if (!checkedNodes.includes(item.__uuid)) {
|
13069
|
+
checkedNodes.forEach((__uuid) => setNodeAttr({
|
13070
|
+
__uuid
|
13071
|
+
}, "__checked", false));
|
13072
|
+
checkedNodes.length = 0;
|
13073
|
+
setNodeAttr(item, "__checked", true);
|
13074
|
+
checkedNodes.push(item.__uuid);
|
13075
|
+
if (!isNodeOpened(item)) {
|
13076
|
+
hanldeTreeNodeClick(item);
|
13077
|
+
}
|
13078
|
+
ctx.emit("check", item, getSchemaVal2(item.__uuid));
|
13079
|
+
}
|
13080
|
+
};
|
13004
13081
|
const checkNodeIsOpen = (node) => isRootNode(node) || isItemOpen(node) || isItemOpen(getNodeAttr2(node, "__parentId"));
|
13005
13082
|
const filterNextNode = (depth, node) => {
|
13006
13083
|
if (isRootNode(node)) {
|
@@ -13035,6 +13112,8 @@ var Component = defineComponent({
|
|
13035
13112
|
renderData,
|
13036
13113
|
flatData,
|
13037
13114
|
hanldeTreeNodeClick,
|
13115
|
+
handleNodeContentClick,
|
13116
|
+
handleNodeActionClick,
|
13038
13117
|
getActionIcon,
|
13039
13118
|
getRootIcon,
|
13040
13119
|
getVirtualLines,
|
@@ -13045,10 +13124,17 @@ var Component = defineComponent({
|
|
13045
13124
|
render() {
|
13046
13125
|
const props = this.$props;
|
13047
13126
|
const renderTreeNode = (item) => createVNode("div", {
|
13127
|
+
"class": getNodeRowClass(item, this.flatData.schema)
|
13128
|
+
}, [createVNode("div", {
|
13048
13129
|
"class": getNodeItemClass(item, this.flatData.schema, props),
|
13049
|
-
"style": getNodeItemStyle(item, props, this.flatData)
|
13050
|
-
|
13051
|
-
|
13130
|
+
"style": getNodeItemStyle(item, props, this.flatData)
|
13131
|
+
}, [createVNode("span", {
|
13132
|
+
"class": "node-action",
|
13133
|
+
"onClick": () => this.handleNodeActionClick(item)
|
13134
|
+
}, [this.getActionIcon(item)]), createVNode("span", {
|
13135
|
+
"class": "node-content",
|
13136
|
+
"onClick": () => this.handleNodeContentClick(item)
|
13137
|
+
}, [[this.getNodePrefixIcon(item), this.getLoadingIcon(item)], createVNode("span", null, [getLabel(item, props)])]), this.getVirtualLines(item)])]);
|
13052
13138
|
return createVNode(BkVirtualRender, {
|
13053
13139
|
"class": "bk-tree",
|
13054
13140
|
"style": getTreeStyle(null, props),
|