/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

function updateTable(parentRef) {
  let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  if (!parentRef || !parentRef.$children || level >= 6) return;
  const children = parentRef.$children;
  for (let i = 0, len = children.length; i < len; i++) {
    var _node$$options, _node$$children;
    const node = children[i];
    const name = node === null || node === void 0 ? void 0 : (_node$$options = node.$options) === null || _node$$options === void 0 ? void 0 : _node$$options.name;
    if (name && /(TTable|TBaseTable|TPrimaryTable|TEnhancedTable)/i.test(name) && node.refreshTable) {
      node.refreshTable();
      return;
    }
    if (node !== null && node !== void 0 && (_node$$children = node.$children) !== null && _node$$children !== void 0 && _node$$children.length) updateTable(node, level + 1);
  }
}
function updateElement(parentRef) {
  updateTable(parentRef);
}
function useDestroyOnClose(parentRef) {
  const updateElement2 = () => {
    updateTable(parentRef);
  };
  return {
    updateElement: updateElement2
  };
}

export { useDestroyOnClose as default, updateElement, updateTable };
//# sourceMappingURL=use-destroy-onclose.js.map
