<template>
  <div class="vm-crud-row">
    <slot />
  </div>
</template>

<script setup lang="ts">
defineOptions({ name: 'vm-row' })
</script>

<style lang="scss" scoped>
.vm-crud-row {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;

  /* 筛选项为空时 vm-search 不渲染，避免占位行撑出顶部空白 */
  &:empty {
    display: none;
  }

  /* 包住表格的行：占满剩余高度，让表内滚动 */
  &:has(.vm-crud-table) {
    flex: 1;
    min-height: 0;
    flex-wrap: nowrap;
    align-items: stretch;
    overflow: hidden;
  }
}

/* 中窄屏工具行：刷新与操作按钮顶对齐、统一换行 */
@media (max-width: 1280px) {
  .vm-crud-row:has(.vm-crud-toolbar) {
    align-items: flex-start;
    gap: 8px;
  }
}
</style>
