row2.mjs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { defineComponent, computed, provide, openBlock, createBlock, resolveDynamicComponent, normalizeClass, unref, normalizeStyle, withCtx, renderSlot } from 'vue';
  2. import { rowContextKey } from './constants.mjs';
  3. import { rowProps } from './row.mjs';
  4. import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
  5. import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
  6. const __default__ = defineComponent({
  7. name: "ElRow"
  8. });
  9. const _sfc_main = /* @__PURE__ */ defineComponent({
  10. ...__default__,
  11. props: rowProps,
  12. setup(__props) {
  13. const props = __props;
  14. const ns = useNamespace("row");
  15. const gutter = computed(() => props.gutter);
  16. provide(rowContextKey, {
  17. gutter
  18. });
  19. const style = computed(() => {
  20. const styles = {};
  21. if (!props.gutter) {
  22. return styles;
  23. }
  24. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  25. return styles;
  26. });
  27. const rowKls = computed(() => [
  28. ns.b(),
  29. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  30. ns.is(`align-${props.align}`, !!props.align)
  31. ]);
  32. return (_ctx, _cache) => {
  33. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  34. class: normalizeClass(unref(rowKls)),
  35. style: normalizeStyle(unref(style))
  36. }, {
  37. default: withCtx(() => [
  38. renderSlot(_ctx.$slots, "default")
  39. ]),
  40. _: 3
  41. }, 8, ["class", "style"]);
  42. };
  43. }
  44. });
  45. var Row = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "row.vue"]]);
  46. export { Row as default };
  47. //# sourceMappingURL=row2.mjs.map