bkui-vue 0.0.1-beta.140 → 0.0.1-beta.141
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 +37 -16
- package/dist/index.umd.js +23 -23
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/cascader/cascader-panel.d.ts +1 -0
- package/lib/cascader/cascader.css +8 -1
- package/lib/cascader/cascader.d.ts +8 -1
- package/lib/cascader/cascader.less +9 -1
- package/lib/cascader/cascader.variable.css +8 -1
- package/lib/cascader/index.d.ts +25 -3
- package/lib/cascader/index.js +1 -1
- package/lib/cascader/interface.d.ts +4 -1
- package/lib/cascader/node.d.ts +2 -1
- package/lib/cascader/store.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -7960,14 +7960,6 @@ function debounce(delay = 300, fn2, immediate = false) {
|
|
7960
7960
|
};
|
7961
7961
|
return debounced;
|
7962
7962
|
}
|
7963
|
-
function filterProperty(data2, filter) {
|
7964
|
-
return JSON.parse(JSON.stringify(data2, (key2, value) => {
|
7965
|
-
if (filter.includes(key2)) {
|
7966
|
-
return void 0;
|
7967
|
-
}
|
7968
|
-
return value;
|
7969
|
-
}));
|
7970
|
-
}
|
7971
7963
|
function arrayEqual(arr1 = [], arr2 = []) {
|
7972
7964
|
if (arr1.length !== arr2.length) {
|
7973
7965
|
return false;
|
@@ -25909,6 +25901,18 @@ var CascaderPanel = defineComponent({
|
|
25909
25901
|
if ((_a = node.children) == null ? void 0 : _a.length) {
|
25910
25902
|
menus.list.push(node.children);
|
25911
25903
|
activePath.value.push(node);
|
25904
|
+
return;
|
25905
|
+
}
|
25906
|
+
if (store.config.isRemote && !node.isLeaf) {
|
25907
|
+
node.loading = true;
|
25908
|
+
const updateNodes = (nodeData) => {
|
25909
|
+
store.appendNodes(nodeData, node || null);
|
25910
|
+
menus.list.push(node.children);
|
25911
|
+
activePath.value.push(node);
|
25912
|
+
node.loading = false;
|
25913
|
+
};
|
25914
|
+
store.config.remoteMethod(node, updateNodes);
|
25915
|
+
console.log("remote fuck here");
|
25912
25916
|
}
|
25913
25917
|
};
|
25914
25918
|
const nodeEvent = (node) => {
|
@@ -25948,6 +25952,11 @@ var CascaderPanel = defineComponent({
|
|
25948
25952
|
node.setNodeCheck(value);
|
25949
25953
|
nodeCheckHandler(node);
|
25950
25954
|
};
|
25955
|
+
const iconRender = (node) => node.loading ? createVNode(spinner, {
|
25956
|
+
"class": "icon-spinner"
|
25957
|
+
}, null) : createVNode(angleRight, {
|
25958
|
+
"class": "icon-angle-right"
|
25959
|
+
}, null);
|
25951
25960
|
return {
|
25952
25961
|
menus,
|
25953
25962
|
activePath,
|
@@ -25957,7 +25966,8 @@ var CascaderPanel = defineComponent({
|
|
25957
25966
|
isCheckedNode,
|
25958
25967
|
checkValue,
|
25959
25968
|
nodeClear,
|
25960
|
-
checkNode
|
25969
|
+
checkNode,
|
25970
|
+
iconRender
|
25961
25971
|
};
|
25962
25972
|
},
|
25963
25973
|
render() {
|
@@ -25980,9 +25990,7 @@ var CascaderPanel = defineComponent({
|
|
25980
25990
|
"onChange": (val) => this.checkNode(node, val)
|
25981
25991
|
}, null), createVNode("span", {
|
25982
25992
|
"class": "bk-cascader-node-name"
|
25983
|
-
}, [node.name]), !node.isLeaf ?
|
25984
|
-
"class": "icon-angle-right"
|
25985
|
-
}, null) : ""]))]))]);
|
25993
|
+
}, [node.name]), !node.isLeaf ? this.iconRender(node) : ""]))]))]);
|
25986
25994
|
}
|
25987
25995
|
});
|
25988
25996
|
class Node$1 {
|
@@ -25990,25 +25998,30 @@ class Node$1 {
|
|
25990
25998
|
this.data = node;
|
25991
25999
|
this.config = config;
|
25992
26000
|
this.parent = parent || null;
|
26001
|
+
this.leaf = node.leaf;
|
25993
26002
|
this.level = !this.parent ? 1 : this.parent.level + 1;
|
25994
26003
|
this.initState();
|
25995
26004
|
}
|
25996
26005
|
initState() {
|
25997
|
-
var _a;
|
25998
26006
|
const { idKey, nameKey, childrenKey } = this.config;
|
25999
26007
|
this.id = this.data[idKey];
|
26000
26008
|
this.name = this.data[nameKey];
|
26001
26009
|
this.loading = false;
|
26010
|
+
this.loaded = false;
|
26002
26011
|
this.checked = false;
|
26003
26012
|
const childrenData = this.data[childrenKey];
|
26004
26013
|
this.children = (childrenData || []).map((child) => new Node$1(child, this.config, this));
|
26005
|
-
this.hasChildren = ((_a = this.children) == null ? void 0 : _a.length) !== 0;
|
26006
26014
|
this.pathNodes = this.calculateNodesPath();
|
26007
26015
|
this.path = this.pathNodes.map((node) => node.id);
|
26008
26016
|
this.pathNames = this.pathNodes.map((node) => node.name);
|
26009
26017
|
}
|
26010
26018
|
get isLeaf() {
|
26011
|
-
|
26019
|
+
var _a;
|
26020
|
+
if (this.config.isRemote) {
|
26021
|
+
const isLeaf = this.leaf || (this.loaded ? !this.children.length : false);
|
26022
|
+
return isLeaf;
|
26023
|
+
}
|
26024
|
+
return !(Array.isArray(this.children) && ((_a = this.children) == null ? void 0 : _a.length) !== 0);
|
26012
26025
|
}
|
26013
26026
|
get isDisabled() {
|
26014
26027
|
return this.data.disabled;
|
@@ -26039,8 +26052,8 @@ class Store {
|
|
26039
26052
|
constructor(props) {
|
26040
26053
|
const { list } = props;
|
26041
26054
|
this.data = list;
|
26042
|
-
this.config = filterProperty(props, ["list"]);
|
26043
26055
|
this.nodes = this.data.map((node) => new Node$1(node, this.config));
|
26056
|
+
this.config = props;
|
26044
26057
|
}
|
26045
26058
|
getNodes() {
|
26046
26059
|
return this.nodes;
|
@@ -26056,6 +26069,14 @@ class Store {
|
|
26056
26069
|
const nodes = this.getFlattedNodes().filter((node) => arrayEqual(node.path, value));
|
26057
26070
|
return (_a = nodes[0]) != null ? _a : null;
|
26058
26071
|
}
|
26072
|
+
appendNode(nodeData, parentNode) {
|
26073
|
+
const node = new Node$1(nodeData, this.config, parentNode);
|
26074
|
+
const children = parentNode ? parentNode.children : this.nodes;
|
26075
|
+
children.push(node);
|
26076
|
+
}
|
26077
|
+
appendNodes(nodeDataList, parentNode) {
|
26078
|
+
nodeDataList.forEach((node) => this.appendNode(node, parentNode));
|
26079
|
+
}
|
26059
26080
|
}
|
26060
26081
|
var Component$5 = defineComponent({
|
26061
26082
|
name: "Cascader",
|