bkui-vue 0.0.1-beta.121 → 0.0.1-beta.124
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 +26 -26
- package/dist/index.esm.js +105 -29
- package/dist/index.umd.js +26 -26
- package/dist/style.css +1 -1
- package/lib/affix/index.js +1 -1
- package/lib/alert/index.js +1 -1
- package/lib/animate-number/index.js +1 -1
- package/lib/backtop/index.js +1 -1
- package/lib/badge/index.js +1 -1
- package/lib/breadcrumb/index.js +1 -1
- package/lib/button/index.js +1 -1
- package/lib/card/index.js +1 -1
- package/lib/cascader/index.js +1 -1
- package/lib/checkbox/checkbox.css +16 -4
- package/lib/checkbox/checkbox.d.ts +11 -3
- package/lib/checkbox/checkbox.less +22 -4
- package/lib/checkbox/checkbox.variable.css +16 -4
- package/lib/checkbox/index.d.ts +19 -5
- package/lib/checkbox/index.js +1 -1
- package/lib/code-diff/index.js +1 -1
- package/lib/collapse/index.js +1 -1
- package/lib/components.js +1 -1
- package/lib/container/index.js +1 -1
- package/lib/date-picker/index.js +1 -1
- package/lib/dialog/index.js +1 -1
- package/lib/directives/index.js +1 -1
- package/lib/dist.index.js +1 -1
- package/lib/divider/index.js +1 -1
- package/lib/dropdown/index.js +1 -1
- package/lib/exception/index.js +1 -1
- package/lib/fixed-navbar/index.js +1 -1
- package/lib/form/index.js +1 -1
- package/lib/icon/angle-double-down-line.js +1 -1
- package/lib/icon/angle-double-left-line.js +1 -1
- package/lib/icon/angle-double-left.js +1 -1
- package/lib/icon/angle-double-right-line.js +1 -1
- package/lib/icon/angle-double-right.js +1 -1
- package/lib/icon/angle-double-up-line.js +1 -1
- package/lib/icon/angle-down-fill.js +1 -1
- package/lib/icon/angle-down-line.js +1 -1
- package/lib/icon/angle-down.js +1 -1
- package/lib/icon/angle-left.js +1 -1
- package/lib/icon/angle-right.js +1 -1
- package/lib/icon/angle-up-fill.js +1 -1
- package/lib/icon/angle-up.js +1 -1
- package/lib/icon/archive-fill.js +1 -1
- package/lib/icon/arrows-left.js +1 -1
- package/lib/icon/arrows-right.js +1 -1
- package/lib/icon/audio-fill.js +1 -1
- package/lib/icon/bk.js +1 -1
- package/lib/icon/circle.js +1 -1
- package/lib/icon/close-line.js +1 -1
- package/lib/icon/close.js +1 -1
- package/lib/icon/code.js +1 -1
- package/lib/icon/cog-shape.js +1 -1
- package/lib/icon/collapse-left.js +1 -1
- package/lib/icon/copy.js +1 -1
- package/lib/icon/data-shape.js +1 -1
- package/lib/icon/del.js +1 -1
- package/lib/icon/doc-fill.js +1 -1
- package/lib/icon/done.js +1 -1
- package/lib/icon/down-shape.js +1 -1
- package/lib/icon/down-small.js +1 -1
- package/lib/icon/edit-line.js +1 -1
- package/lib/icon/ellipsis.js +1 -1
- package/lib/icon/error.js +1 -1
- package/lib/icon/excel-fill.js +1 -1
- package/lib/icon/exclamation-circle-shape.js +1 -1
- package/lib/icon/eye.js +1 -1
- package/lib/icon/folder-open.js +1 -1
- package/lib/icon/folder-shape-open.js +1 -1
- package/lib/icon/folder-shape.js +1 -1
- package/lib/icon/funnel.js +1 -1
- package/lib/icon/help-document-fill.js +1 -1
- package/lib/icon/help-fill.js +1 -1
- package/lib/icon/help.js +1 -1
- package/lib/icon/image-fill.js +1 -1
- package/lib/icon/index.js +1 -1
- package/lib/icon/info-line.js +1 -1
- package/lib/icon/info.js +1 -1
- package/lib/icon/left-shape.js +1 -1
- package/lib/icon/pdf-fill.js +1 -1
- package/lib/icon/play-shape.js +1 -1
- package/lib/icon/plus.js +1 -1
- package/lib/icon/ppt-fill.js +1 -1
- package/lib/icon/qq.js +1 -1
- package/lib/icon/right-shape.js +1 -1
- package/lib/icon/search.js +1 -1
- package/lib/icon/share.js +1 -1
- package/lib/icon/spinner.js +1 -1
- package/lib/icon/success.js +1 -1
- package/lib/icon/switcher-loading.js +1 -1
- package/lib/icon/text-file.js +1 -1
- package/lib/icon/text-fill.js +1 -1
- package/lib/icon/tree-application-shape.js +1 -1
- package/lib/icon/unvisible.js +1 -1
- package/lib/icon/up-shape.js +1 -1
- package/lib/icon/upload.js +1 -1
- package/lib/icon/video-fill.js +1 -1
- package/lib/icon/warn.js +1 -1
- package/lib/icon/weixin.js +1 -1
- package/lib/index.js +1 -1
- package/lib/input/index.js +1 -1
- package/lib/link/index.js +1 -1
- package/lib/loading/index.js +1 -1
- package/lib/menu/index.js +1 -1
- package/lib/message/index.js +1 -1
- package/lib/modal/index.js +1 -1
- package/lib/navigation/index.js +1 -1
- package/lib/notify/index.js +1 -1
- package/lib/pagination/index.js +1 -1
- package/lib/popover/index.js +1 -1
- package/lib/popover2/index.js +1 -1
- package/lib/preset.js +1 -1
- package/lib/process/index.js +1 -1
- package/lib/progress/index.js +1 -1
- package/lib/radio/index.js +1 -1
- package/lib/rate/index.js +1 -1
- package/lib/resize-layout/index.js +1 -1
- package/lib/select/index.js +1 -1
- package/lib/shared/index.js +1 -1
- package/lib/sideslider/index.js +1 -1
- package/lib/slider/index.js +1 -1
- package/lib/steps/index.js +1 -1
- package/lib/swiper/index.js +1 -1
- package/lib/switcher/index.js +1 -1
- package/lib/tab/index.js +1 -1
- package/lib/table/const.d.ts +4 -0
- package/lib/table/index.js +1 -1
- package/lib/table/props.d.ts +5 -0
- package/lib/table/table.css +19 -3
- package/lib/table/table.less +3 -4
- package/lib/table/table.variable.css +19 -3
- package/lib/table/use-common.d.ts +4 -2
- package/lib/tag/index.js +1 -1
- package/lib/tag-input/index.js +1 -1
- package/lib/timeline/index.js +1 -1
- package/lib/transfer/index.js +1 -1
- package/lib/tree/constant.d.ts +3 -1
- package/lib/tree/index.d.ts +54 -2
- package/lib/tree/index.js +1 -1
- package/lib/tree/props.d.ts +16 -0
- package/lib/tree/tree.css +36 -0
- package/lib/tree/tree.d.ts +24 -0
- package/lib/tree/tree.less +24 -0
- package/lib/tree/tree.variable.css +36 -0
- package/lib/tree/use-node-action.d.ts +2 -1
- package/lib/tree/use-node-attribute.d.ts +1 -0
- package/lib/upload/index.js +1 -1
- package/lib/virtual-render/index.js +1 -1
- package/lib/virtual-render/virtual-render.css +17 -17
- package/lib/virtual-render/virtual-render.less +2 -23
- package/lib/virtual-render/virtual-render.variable.css +119 -17
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -9649,13 +9649,13 @@ const checkboxProps = {
|
|
9649
9649
|
checked: PropTypes.bool.def(false),
|
9650
9650
|
indeterminate: PropTypes.bool,
|
9651
9651
|
beforeChange: PropTypes.func,
|
9652
|
-
size: PropTypes.size()
|
9652
|
+
size: PropTypes.size().def("large")
|
9653
9653
|
};
|
9654
9654
|
var Component$v = defineComponent({
|
9655
9655
|
name: "Checkbox",
|
9656
9656
|
props: checkboxProps,
|
9657
9657
|
emits: ["update:modelValue", "change"],
|
9658
|
-
setup() {
|
9658
|
+
setup(props) {
|
9659
9659
|
const [isFocus, {
|
9660
9660
|
blur: handleBlur,
|
9661
9661
|
focus: handleFocus
|
@@ -9673,7 +9673,8 @@ var Component$v = defineComponent({
|
|
9673
9673
|
setChecked,
|
9674
9674
|
handleBlur,
|
9675
9675
|
handleFocus,
|
9676
|
-
handleChange
|
9676
|
+
handleChange,
|
9677
|
+
size: props.size
|
9677
9678
|
};
|
9678
9679
|
},
|
9679
9680
|
render() {
|
@@ -9687,7 +9688,7 @@ var Component$v = defineComponent({
|
|
9687
9688
|
return createVNode("label", {
|
9688
9689
|
"class": checkboxClass
|
9689
9690
|
}, [createVNode("span", {
|
9690
|
-
"class": "
|
9691
|
+
"class": [resolveClassName("checkbox-input"), this.size]
|
9691
9692
|
}, [createVNode("input", {
|
9692
9693
|
"role": "checkbox",
|
9693
9694
|
"type": "checkbox",
|
@@ -14902,8 +14903,8 @@ const virtualRenderProps = __spreadValues({
|
|
14902
14903
|
className: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.object, PropTypes.arrayOf(PropTypes.object), PropTypes.string]).def(""),
|
14903
14904
|
contentClassName: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.object, PropTypes.arrayOf(PropTypes.object), PropTypes.string]).def(""),
|
14904
14905
|
contentStyle: PropTypes.object.def({}),
|
14905
|
-
scrollXName: PropTypes.string.def("
|
14906
|
-
scrollYName: PropTypes.string.def("
|
14906
|
+
scrollXName: PropTypes.string.def(resolveClassName("F-scroll-x")),
|
14907
|
+
scrollYName: PropTypes.string.def(resolveClassName("F-scroll-y")),
|
14907
14908
|
groupItemCount: PropTypes.number.def(1),
|
14908
14909
|
preloadItemCount: PropTypes.number.def(1),
|
14909
14910
|
renderAs: PropTypes.string.def("div"),
|
@@ -15036,7 +15037,7 @@ var Component$d = defineComponent({
|
|
15036
15037
|
renderAs,
|
15037
15038
|
contentAs
|
15038
15039
|
} = props;
|
15039
|
-
const
|
15040
|
+
const resolvePropClassName = (prop) => {
|
15040
15041
|
if (typeof prop === "string") {
|
15041
15042
|
return [prop];
|
15042
15043
|
}
|
@@ -15144,8 +15145,8 @@ var Component$d = defineComponent({
|
|
15144
15145
|
display: isHidden ? "none" : "block"
|
15145
15146
|
};
|
15146
15147
|
});
|
15147
|
-
const wrapperClass = computed(() => ["
|
15148
|
-
const innerClass = computed(() => [props.scrollPosition === "content" ? "
|
15148
|
+
const wrapperClass = computed(() => [resolveClassName("virtual-render"), props.scrollXName, props.scrollYName, ...resolvePropClassName(props.className), props.scrollPosition === "container" ? resolveClassName("virtual-content") : ""]);
|
15149
|
+
const innerClass = computed(() => [props.scrollPosition === "content" ? resolveClassName("virtual-content") : "", ...resolvePropClassName(props.contentClassName)]);
|
15149
15150
|
const vVirtualRender = resolveDirective("bkVirtualRender");
|
15150
15151
|
const dirModifier = {
|
15151
15152
|
lineHeight: props.lineHeight,
|
@@ -15172,7 +15173,7 @@ var Component$d = defineComponent({
|
|
15172
15173
|
}, [(_f = (_e = (_d = ctx.slots).default) == null ? void 0 : _e.call(_d, {
|
15173
15174
|
data: calcList.value
|
15174
15175
|
})) != null ? _f : ""]), [[vVirtualRender, dirModifier]]), (_i = (_h = (_g = ctx.slots).afterContent) == null ? void 0 : _h.call(_g)) != null ? _i : "", h$1("div", {
|
15175
|
-
class: ["
|
15176
|
+
class: [resolveClassName("virtual-section")],
|
15176
15177
|
style: innerStyle.value
|
15177
15178
|
})]);
|
15178
15179
|
};
|
@@ -15225,6 +15226,7 @@ const TABLE_ROW_ATTRIBUTE = {
|
|
15225
15226
|
ROW_UID: "__$uuid",
|
15226
15227
|
ROW_EXPAND: "__row_expand"
|
15227
15228
|
};
|
15229
|
+
const SCROLLY_WIDTH = 4;
|
15228
15230
|
const resolvePaginationOption = (propPagination, defVal) => {
|
15229
15231
|
if (!!propPagination) {
|
15230
15232
|
if (typeof propPagination === "object") {
|
@@ -15377,7 +15379,7 @@ const tableProps = {
|
|
15377
15379
|
activeColumn: PropTypes.oneOfType([PropTypes.number.def(-1), PropTypes.arrayOf(PropTypes.number.def(-1))]),
|
15378
15380
|
columnPick: PropTypes.commonType(["multi", "single", "disabled"], "columnPick").def("disabled"),
|
15379
15381
|
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def("auto"),
|
15380
|
-
minHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def(
|
15382
|
+
minHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def(80),
|
15381
15383
|
maxHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def("auto"),
|
15382
15384
|
rowHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.func]).def(40),
|
15383
15385
|
headHeight: PropTypes.number.def(40),
|
@@ -16413,7 +16415,7 @@ var useFixedColumn = (props, colgroups, hasScrollY) => {
|
|
16413
16415
|
right: (ignoreFirst = true) => colgroups.filter((col) => col.fixed === "right").reduce((offset2, curr, index) => {
|
16414
16416
|
const outOffset = ignoreFirst && index === 0 ? offset2 : offset2 + getColumnReactWidth(curr);
|
16415
16417
|
return outOffset;
|
16416
|
-
}, hasScrollY ?
|
16418
|
+
}, hasScrollY ? SCROLLY_WIDTH : 0)
|
16417
16419
|
};
|
16418
16420
|
const reolveFixRightOffset = resolveFixOffset.right;
|
16419
16421
|
const getFixedColumnStyleResolve = () => {
|
@@ -17015,8 +17017,18 @@ const useClass = (props, root, reactiveProp, pageData) => {
|
|
17015
17017
|
[resolveClassName("table-footer")]: true,
|
17016
17018
|
["is-hidden"]: !props.pagination || !props.data.length
|
17017
17019
|
}));
|
17020
|
+
const resolveWidth2 = () => {
|
17021
|
+
if (props.columns.every((col) => /^\d+\.?\d*(px)?$/ig.test(`${col.width}`))) {
|
17022
|
+
const rectWidth = props.columns.reduce((width, col) => width + Number(`${col.width}`.replace(/px/ig, "")), 0);
|
17023
|
+
const offset2 = hasScrollY.value ? SCROLLY_WIDTH : 0;
|
17024
|
+
return `${rectWidth + offset2}px`;
|
17025
|
+
}
|
17026
|
+
return "100%";
|
17027
|
+
};
|
17018
17028
|
const wrapperStyle = computed(() => ({
|
17019
|
-
minHeight: resolveNumberOrStringToPix(props.minHeight, "auto")
|
17029
|
+
minHeight: resolveNumberOrStringToPix(props.minHeight, "auto"),
|
17030
|
+
width: resolveWidth2(),
|
17031
|
+
maxWidth: "100%"
|
17020
17032
|
}));
|
17021
17033
|
const resolvePropHeight = (height, defaultValue) => {
|
17022
17034
|
const strHeight = String(height);
|
@@ -17065,7 +17077,7 @@ const useClass = (props, root, reactiveProp, pageData) => {
|
|
17065
17077
|
const getColumnsWidthOffsetWidth = () => {
|
17066
17078
|
let offsetWidth = 0;
|
17067
17079
|
if (hasScrollY.value) {
|
17068
|
-
offsetWidth = offsetWidth +
|
17080
|
+
offsetWidth = offsetWidth + SCROLLY_WIDTH;
|
17069
17081
|
}
|
17070
17082
|
if (props.border.includes(BORDER_OPTION.OUTER) && !props.border.includes(BORDER_OPTION.NONE)) {
|
17071
17083
|
offsetWidth = offsetWidth + 2;
|
@@ -17314,9 +17326,11 @@ var Component$b = defineComponent({
|
|
17314
17326
|
};
|
17315
17327
|
onMounted(() => {
|
17316
17328
|
observerIns = observerResize(root.value, () => {
|
17317
|
-
if (props.height === "100%") {
|
17329
|
+
if (props.height === "100%" || props.height === "auto") {
|
17318
17330
|
resetTableHeight(root.value);
|
17319
17331
|
}
|
17332
|
+
const offset2 = getColumnsWidthOffsetWidth();
|
17333
|
+
resolveColumnWidth(root.value, colgroups, 20, offset2);
|
17320
17334
|
}, 60, true);
|
17321
17335
|
observerIns.start();
|
17322
17336
|
});
|
@@ -17328,9 +17342,9 @@ var Component$b = defineComponent({
|
|
17328
17342
|
ctx.expose({
|
17329
17343
|
setRowExpand
|
17330
17344
|
});
|
17331
|
-
const tableBodyClass = __spreadProps(__spreadValues({}, contentClass), {
|
17345
|
+
const tableBodyClass = computed(() => __spreadProps(__spreadValues({}, contentClass), {
|
17332
17346
|
"__is-empty": !pageData.length
|
17333
|
-
});
|
17347
|
+
}));
|
17334
17348
|
const tableBodyContentClass = {
|
17335
17349
|
[resolveClassName("table-body-content")]: true,
|
17336
17350
|
"with-virtual-render": props.virtualEnabled
|
@@ -17349,6 +17363,10 @@ var Component$b = defineComponent({
|
|
17349
17363
|
const {
|
17350
17364
|
renderScrollLoading
|
17351
17365
|
} = useScrollLoading(props, ctx);
|
17366
|
+
const scrollClass = props.virtualEnabled ? {} : {
|
17367
|
+
scrollXName: "",
|
17368
|
+
scrollYName: ""
|
17369
|
+
};
|
17352
17370
|
return () => createVNode("div", {
|
17353
17371
|
"class": tableClass.value,
|
17354
17372
|
"style": wrapperStyle.value,
|
@@ -17358,18 +17376,19 @@ var Component$b = defineComponent({
|
|
17358
17376
|
"class": headClass,
|
17359
17377
|
"style": headStyle.value
|
17360
17378
|
}, [tableRender.renderTableHeadSchema()]),
|
17361
|
-
createVNode(BkVirtualRender, {
|
17379
|
+
createVNode(BkVirtualRender, mergeProps({
|
17362
17380
|
"ref": refVirtualRender,
|
17363
17381
|
"lineHeight": tableRender.getRowHeight,
|
17364
|
-
"class": tableBodyClass,
|
17382
|
+
"class": tableBodyClass.value,
|
17365
17383
|
"style": contentStyle,
|
17366
|
-
"list": pageData
|
17384
|
+
"list": pageData
|
17385
|
+
}, scrollClass, {
|
17367
17386
|
"contentClassName": tableBodyContentClass,
|
17368
17387
|
"onContentScroll": handleScrollChanged,
|
17369
17388
|
"throttleDelay": 0,
|
17370
17389
|
"scrollEvent": true,
|
17371
17390
|
"enabled": props.virtualEnabled
|
17372
|
-
}, {
|
17391
|
+
}), {
|
17373
17392
|
default: (scope) => tableRender.renderTableBodySchema(scope.data || props.data)
|
17374
17393
|
}),
|
17375
17394
|
createVNode("div", {
|
@@ -23763,13 +23782,15 @@ var EVENTS = /* @__PURE__ */ ((EVENTS2) => {
|
|
23763
23782
|
EVENTS2["NODE_CLICK"] = "nodeClick";
|
23764
23783
|
EVENTS2["NODE_COLLAPSE"] = "nodeCollapse";
|
23765
23784
|
EVENTS2["NODE_EXPAND"] = "nodeExpand";
|
23785
|
+
EVENTS2["NODE_CHECKED"] = "nodeChecked";
|
23766
23786
|
return EVENTS2;
|
23767
23787
|
})(EVENTS || {});
|
23768
23788
|
const EMPTY = (..._args) => true;
|
23769
23789
|
const TreeEmitEventsType = {
|
23770
23790
|
["nodeClick"]: EMPTY,
|
23771
23791
|
["nodeCollapse"]: EMPTY,
|
23772
|
-
["nodeExpand"]: EMPTY
|
23792
|
+
["nodeExpand"]: EMPTY,
|
23793
|
+
["nodeChecked"]: EMPTY
|
23773
23794
|
};
|
23774
23795
|
var NODE_ATTRIBUTES = /* @__PURE__ */ ((NODE_ATTRIBUTES2) => {
|
23775
23796
|
NODE_ATTRIBUTES2["DEPTH"] = "__depth";
|
@@ -23848,6 +23869,8 @@ const treeProps = {
|
|
23848
23869
|
draggable: PropTypes.bool.def(false),
|
23849
23870
|
dragSort: PropTypes.bool.def(false),
|
23850
23871
|
selectable: PropTypes.bool.def(true),
|
23872
|
+
showCheckbox: PropTypes.bool.def(false),
|
23873
|
+
showNodeTypeIcon: PropTypes.bool.def(true),
|
23851
23874
|
selected: PropTypes.oneOfType([PropTypes.string, null, PropTypes.number, PropTypes.object]).def(null),
|
23852
23875
|
autoCheckChildren: PropTypes.bool.def(true),
|
23853
23876
|
autoOpenParentNode: PropTypes.bool.def(true)
|
@@ -23892,6 +23915,7 @@ var useNodeAttribute = (flatData, props) => {
|
|
23892
23915
|
setNodeAttr(node, NODE_ATTRIBUTES.IS_LOADING, value);
|
23893
23916
|
};
|
23894
23917
|
const deleteNodeSchema = (id) => flatData.schema.delete(id);
|
23918
|
+
const getParentNode2 = (node) => getSchemaVal2(getNodeParentId(node));
|
23895
23919
|
const isItemOpen = (item) => {
|
23896
23920
|
var _a;
|
23897
23921
|
if (typeof item === "object") {
|
@@ -23945,6 +23969,7 @@ var useNodeAttribute = (flatData, props) => {
|
|
23945
23969
|
getNodeParentId,
|
23946
23970
|
getNodeParentIdById,
|
23947
23971
|
getParentNodeData,
|
23972
|
+
getParentNode: getParentNode2,
|
23948
23973
|
setNodeAttr,
|
23949
23974
|
getNodePath,
|
23950
23975
|
isRootNode,
|
@@ -24133,6 +24158,8 @@ var useNodeAction = (props, ctx, flatData, renderData, schemaValues, initOption)
|
|
24133
24158
|
isItemOpen,
|
24134
24159
|
isNodeOpened,
|
24135
24160
|
isNodeLoading,
|
24161
|
+
isNodeChecked,
|
24162
|
+
getParentNode: getParentNode2,
|
24136
24163
|
resolveScopedSlotParam,
|
24137
24164
|
extendNodeAttr
|
24138
24165
|
} = useNodeAttribute(flatData, props);
|
@@ -24144,9 +24171,9 @@ var useNodeAction = (props, ctx, flatData, renderData, schemaValues, initOption)
|
|
24144
24171
|
deepAutoOpen
|
24145
24172
|
} = useNodeAsync(props, flatData);
|
24146
24173
|
const getRootIcon = (item) => isItemOpen(item) ? createVNode(folderShapeOpen, {
|
24147
|
-
"class": resolveClassName("tree-icon")
|
24174
|
+
"class": [resolveClassName("tree-icon"), resolveClassName("node-prefix")]
|
24148
24175
|
}, null) : createVNode(folder, {
|
24149
|
-
"class": resolveClassName("tree-icon")
|
24176
|
+
"class": [resolveClassName("tree-icon"), resolveClassName("node-prefix")]
|
24150
24177
|
}, null);
|
24151
24178
|
const renderPrefixVal = (val) => {
|
24152
24179
|
if (typeof val === "string") {
|
@@ -24189,12 +24216,19 @@ var useNodeAction = (props, ctx, flatData, renderData, schemaValues, initOption)
|
|
24189
24216
|
}
|
24190
24217
|
if (prefixFnVal === "default" || typeof props.prefixIcon === "boolean" && props.prefixIcon) {
|
24191
24218
|
if (hasChildNode(item) || item.async || !props.autoCheckChildren) {
|
24192
|
-
return isItemOpen(item) ? createVNode(downShape,
|
24219
|
+
return isItemOpen(item) ? createVNode(downShape, {
|
24220
|
+
"class": resolveClassName("node-prefix")
|
24221
|
+
}, null) : createVNode(rightShape, {
|
24222
|
+
"class": resolveClassName("node-prefix")
|
24223
|
+
}, null);
|
24193
24224
|
}
|
24194
24225
|
}
|
24195
24226
|
return null;
|
24196
24227
|
};
|
24197
24228
|
const getNodePrefixIcon = (item) => {
|
24229
|
+
if (!props.showNodeTypeIcon) {
|
24230
|
+
return null;
|
24231
|
+
}
|
24198
24232
|
if (ctx.slots.nodeType) {
|
24199
24233
|
return ctx.slots.nodeType(extendNodeAttr(item));
|
24200
24234
|
}
|
@@ -24207,11 +24241,40 @@ var useNodeAction = (props, ctx, flatData, renderData, schemaValues, initOption)
|
|
24207
24241
|
}
|
24208
24242
|
if (prefixFnVal === "default" || typeof props.prefixIcon === "boolean" && props.prefixIcon) {
|
24209
24243
|
return isRootNode(item) || hasChildNode(item) ? getRootIcon(item) : createVNode(textFile, {
|
24210
|
-
"class": resolveClassName("tree-icon")
|
24244
|
+
"class": [resolveClassName("tree-icon"), resolveClassName("node-prefix")]
|
24211
24245
|
}, null);
|
24212
24246
|
}
|
24213
24247
|
return null;
|
24214
24248
|
};
|
24249
|
+
const updateParentChecked = (item, isChecked) => {
|
24250
|
+
const parent = getParentNode2(item);
|
24251
|
+
const checked = isChecked || schemaValues.value.filter((node) => String.prototype.startsWith.call(getNodePath(node), getNodePath(item))).some((filterNode) => isNodeChecked(filterNode));
|
24252
|
+
if (parent) {
|
24253
|
+
setNodeAttr(parent, NODE_ATTRIBUTES.IS_CHECKED, checked);
|
24254
|
+
if (!isRootNode(parent)) {
|
24255
|
+
updateParentChecked(parent, isChecked);
|
24256
|
+
}
|
24257
|
+
}
|
24258
|
+
};
|
24259
|
+
const handleNodeItemCheckboxChange = (item, value) => {
|
24260
|
+
setNodeAttr(item, NODE_ATTRIBUTES.IS_CHECKED, !!value);
|
24261
|
+
schemaValues.value.filter((node) => String.prototype.startsWith.call(getNodePath(node), getNodePath(item))).forEach((filterNode) => setNodeAttr(filterNode, NODE_ATTRIBUTES.IS_CHECKED, !!value));
|
24262
|
+
updateParentChecked(item, value);
|
24263
|
+
ctx.emit(EVENTS.NODE_CHECKED, schemaValues.value.filter((t2) => isNodeChecked(t2)).map((n2) => n2[NODE_ATTRIBUTES.UUID]));
|
24264
|
+
};
|
24265
|
+
const isIndeterminate = (item) => isNodeChecked(item) && !schemaValues.value.filter((node) => String.prototype.startsWith.call(getNodePath(node), getNodePath(item))).every((filterNode) => isNodeChecked(filterNode));
|
24266
|
+
const isNodeItemChecked = (item) => isNodeChecked(item) || schemaValues.value.filter((node) => String.prototype.startsWith.call(getNodePath(node), getNodePath(item))).some((filterNode) => isNodeChecked(filterNode));
|
24267
|
+
const getCheckboxRender = (item) => {
|
24268
|
+
if (!props.showCheckbox) {
|
24269
|
+
return null;
|
24270
|
+
}
|
24271
|
+
return createVNode(BkCheckbox, {
|
24272
|
+
"size": "small",
|
24273
|
+
"modelValue": isNodeItemChecked(item),
|
24274
|
+
"indeterminate": isIndeterminate(item),
|
24275
|
+
"onChange": (val) => handleNodeItemCheckboxChange(item, val)
|
24276
|
+
}, null);
|
24277
|
+
};
|
24215
24278
|
const setNodeOpened = (item, isOpen = null, e = null, fireEmit = true) => {
|
24216
24279
|
const newVal = isOpen === null ? !isItemOpen(item) : !!isOpen;
|
24217
24280
|
if (!newVal) {
|
@@ -24357,11 +24420,11 @@ var useNodeAction = (props, ctx, flatData, renderData, schemaValues, initOption)
|
|
24357
24420
|
"style": getNodeItemStyle(item, props, flatData),
|
24358
24421
|
"onClick": (e) => handleNodeContentClick(item, e)
|
24359
24422
|
}, [createVNode("span", {
|
24360
|
-
"class": resolveClassName("node-action"),
|
24423
|
+
"class": [resolveClassName("node-action")],
|
24361
24424
|
"onClick": (e) => handleNodeActionClick(e, item)
|
24362
24425
|
}, [getActionIcon(item)]), createVNode("span", {
|
24363
24426
|
"class": resolveClassName("node-content")
|
24364
|
-
}, [[getNodePrefixIcon(item)], createVNode("span", {
|
24427
|
+
}, [[getCheckboxRender(item), getNodePrefixIcon(item)], createVNode("span", {
|
24365
24428
|
"class": resolveClassName("node-text")
|
24366
24429
|
}, [(_c = (_b = (_a = ctx.slots).node) == null ? void 0 : _b.call(_a, extendNodeAttr(item))) != null ? _c : [getLabel(item, props)]]), (_e = (_d = ctx.slots).nodeAppend) == null ? void 0 : _e.call(_d, extendNodeAttr(item))]), getVirtualLines(item)])]);
|
24367
24430
|
};
|
@@ -24544,6 +24607,7 @@ var useTreeInit = (props) => {
|
|
24544
24607
|
data: data2,
|
24545
24608
|
children
|
24546
24609
|
} = props2;
|
24610
|
+
const checkedList = [];
|
24547
24611
|
const outputData = [];
|
24548
24612
|
let order2 = 0;
|
24549
24613
|
const schema = /* @__PURE__ */ new Map();
|
@@ -24633,6 +24697,10 @@ var useTreeInit = (props) => {
|
|
24633
24697
|
Object.assign(item, {
|
24634
24698
|
[NODE_ATTRIBUTES.UUID]: uuid2
|
24635
24699
|
});
|
24700
|
+
const isChecked = props2.showCheckbox && getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_CHECKED);
|
24701
|
+
if (isChecked) {
|
24702
|
+
checkedList.push(uuid2);
|
24703
|
+
}
|
24636
24704
|
schema.set(uuid2, {
|
24637
24705
|
[NODE_ATTRIBUTES.DEPTH]: depth,
|
24638
24706
|
[NODE_ATTRIBUTES.INDEX]: i2,
|
@@ -24645,7 +24713,7 @@ var useTreeInit = (props) => {
|
|
24645
24713
|
[NODE_ATTRIBUTES.IS_SELECTED]: isCachedTreeNodeSelected(uuid2, item),
|
24646
24714
|
[NODE_ATTRIBUTES.IS_MATCH]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_MATCH),
|
24647
24715
|
[NODE_ATTRIBUTES.IS_OPEN]: isOpened,
|
24648
|
-
[NODE_ATTRIBUTES.IS_CHECKED]:
|
24716
|
+
[NODE_ATTRIBUTES.IS_CHECKED]: isChecked,
|
24649
24717
|
[NODE_ATTRIBUTES.IS_CACHED]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_CACHED),
|
24650
24718
|
[NODE_ATTRIBUTES.IS_ASYNC]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_ASYNC),
|
24651
24719
|
[NODE_ATTRIBUTES.IS_LOADING]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_LOADING),
|
@@ -24664,6 +24732,14 @@ var useTreeInit = (props) => {
|
|
24664
24732
|
}
|
24665
24733
|
}
|
24666
24734
|
flatten(treeData ? treeData : data2);
|
24735
|
+
if (props2.showCheckbox) {
|
24736
|
+
checkedList == null ? void 0 : checkedList.forEach((value) => {
|
24737
|
+
Array.from(schema.values()).filter((t2) => t2[NODE_ATTRIBUTES.PATH].startsWith(schema.get(value)[NODE_ATTRIBUTES.PATH])).forEach((n2) => Object.assign(n2, {
|
24738
|
+
[NODE_ATTRIBUTES.IS_CHECKED]: true
|
24739
|
+
}));
|
24740
|
+
loopUpdateNodeAttr(value, NODE_ATTRIBUTES.IS_CHECKED, true, () => true);
|
24741
|
+
});
|
24742
|
+
}
|
24667
24743
|
return [outputData, schema];
|
24668
24744
|
};
|
24669
24745
|
const formatData = getFlatdata(props);
|