{"version":3,"file":"col2.mjs","names":[],"sources":["../../../../../../packages/components/col/src/col.vue"],"sourcesContent":["<template>\n  <component :is=\"tag\" :class=\"colKls\" :style=\"style\">\n    <slot />\n  </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject } from 'vue'\nimport { isNumber, isObject } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { rowContextKey } from '@element-plus/components/row'\n\nimport type { CSSProperties } from 'vue'\nimport type { ColProps } from './col'\n\ndefineOptions({\n  name: 'ElCol',\n})\n\nconst props = withDefaults(defineProps<ColProps>(), {\n  tag: 'div',\n  span: 24,\n  offset: 0,\n  pull: 0,\n  push: 0,\n  xs: () => ({}),\n  sm: () => ({}),\n  md: () => ({}),\n  lg: () => ({}),\n  xl: () => ({}),\n})\n\nconst { gutter } = inject(rowContextKey, { gutter: computed(() => 0) })\nconst ns = useNamespace('col')\n\nconst style = computed(() => {\n  const styles: CSSProperties = {}\n  if (gutter.value) {\n    styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`\n  }\n  return styles\n})\n\nconst colKls = computed(() => {\n  const classes: string[] = []\n  const pos = ['span', 'offset', 'pull', 'push'] as const\n\n  pos.forEach((prop) => {\n    const size = props[prop]\n    if (isNumber(size)) {\n      if (prop === 'span') classes.push(ns.b(`${props[prop]}`))\n      else if (size > 0) classes.push(ns.b(`${prop}-${props[prop]}`))\n    }\n  })\n\n  const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const\n  sizes.forEach((size) => {\n    if (isNumber(props[size])) {\n      classes.push(ns.b(`${size}-${props[size]}`))\n    } else if (isObject(props[size])) {\n      Object.entries(props[size]).forEach(([prop, sizeProp]) => {\n        classes.push(\n          prop !== 'span'\n            ? ns.b(`${size}-${prop}-${sizeProp}`)\n            : ns.b(`${size}-${sizeProp}`)\n        )\n      })\n    }\n  })\n\n  // this is for the fix\n  if (gutter.value) {\n    classes.push(ns.is('guttered'))\n  }\n  return [ns.b(), classes]\n})\n</script>\n"],"mappings":""}