/**
 * ldesign v0.4.6
 * (c) 2023 ldesign
 * @license MIT
 */

function updateTable(parentRef) {
  var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  if (!parentRef || !parentRef.$children || level >= 6) return;
  var children = parentRef.$children;
  for (var i = 0, len = children.length; i < len; i++) {
    var _node$$options, _node$$children;
    var node = children[i];
    var 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) {
  var updateElement2 = function updateElement2() {
    updateTable(parentRef);
  };
  return {
    updateElement: updateElement2
  };
}

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