25 lines
657 B
JavaScript
25 lines
657 B
JavaScript
"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;
|