import { createVNode as _createVNode } from "vue"; import { computed, defineComponent } from "vue"; import { truthProp, makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs"; import { useChildren } from "@vant/use"; const [name, bem] = createNamespace("row"); const ROW_KEY = Symbol(name); const rowProps = { tag: makeStringProp("div"), wrap: truthProp, align: String, gutter: makeNumericProp(0), justify: String }; var stdin_default = defineComponent({ name, props: rowProps, setup(props, { slots }) { const { children, linkChildren } = useChildren(ROW_KEY); const groups = computed(() => { const groups2 = [[]]; let totalSpan = 0; children.forEach((child, index) => { totalSpan += Number(child.span); if (totalSpan > 24) { groups2.push([index]); totalSpan -= 24; } else { groups2[groups2.length - 1].push(index); } }); return groups2; }); const spaces = computed(() => { const gutter = Number(props.gutter); const spaces2 = []; if (!gutter) { return spaces2; } groups.value.forEach((group) => { const averagePadding = gutter * (group.length - 1) / group.length; group.forEach((item, index) => { if (index === 0) { spaces2.push({ right: averagePadding }); } else { const left = gutter - spaces2[item - 1].right; const right = averagePadding - left; spaces2.push({ left, right }); } }); }); return spaces2; }); linkChildren({ spaces }); return () => { const { tag, wrap, align, justify } = props; return _createVNode(tag, { "class": bem({ [`align-${align}`]: align, [`justify-${justify}`]: justify, nowrap: !wrap }) }, { default: () => { var _a; return [(_a = slots.default) == null ? void 0 : _a.call(slots)]; } }); }; } }); export { ROW_KEY, stdin_default as default };