acdr-ui/dist/dev/mp-weixin/hooks/useColPickerData.js

26 lines
702 B
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"use strict";
const common_vendor = require("../common/vendor.js");
function useColPickerData() {
const colPickerData = common_vendor.useCascaderAreaData();
function findChildrenByCode(data, code) {
if (!code) {
return data;
}
for (const item of data) {
if (item.value === code) {
return item.children || null;
}
if (item.children) {
const childrenResult = findChildrenByCode(item.children, code);
if (childrenResult) {
return childrenResult;
}
}
}
return null;
}
return { colPickerData, findChildrenByCode };
}
exports.useColPickerData = useColPickerData;
//# sourceMappingURL=useColPickerData.js.map