You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
6.2 KiB
1 line
6.2 KiB
3 months ago
|
{"ast":null,"code":"import \"core-js/modules/es.array.push.js\";\nimport { defineComponent, inject, computed, openBlock, createBlock, resolveDynamicComponent, normalizeClass, unref, normalizeStyle, withCtx, renderSlot } from 'vue';\nimport '../../../utils/index.mjs';\nimport '../../../hooks/index.mjs';\nimport '../../row/index.mjs';\nimport { colProps } from './col.mjs';\nimport _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';\nimport { rowContextKey } from '../../row/src/constants.mjs';\nimport { useNamespace } from '../../../hooks/use-namespace/index.mjs';\nimport { isNumber } from '../../../utils/types.mjs';\nimport { isObject } from '@vue/shared';\nconst __default__ = defineComponent({\n name: \"ElCol\"\n});\nconst _sfc_main = /* @__PURE__ */defineComponent({\n ...__default__,\n props: colProps,\n setup(__props) {\n const props = __props;\n const {\n gutter\n } = inject(rowContextKey, {\n gutter: computed(() => 0)\n });\n const ns = useNamespace(\"col\");\n const style = computed(() => {\n const styles = {};\n if (gutter.value) {\n styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;\n }\n return styles;\n });\n const colKls = computed(() => {\n const classes = [];\n const pos = [\"span\", \"offset\", \"pull\", \"push\"];\n pos.forEach(prop => {\n const size = props[prop];\n if (isNumber(size)) {\n if (prop === \"span\") classes.push(ns.b(`${props[prop]}`));else if (size > 0) classes.push(ns.b(`${prop}-${props[prop]}`));\n }\n });\n const sizes = [\"xs\", \"sm\", \"md\", \"lg\", \"xl\"];\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(prop !== \"span\" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));\n });\n }\n });\n if (gutter.value) {\n classes.push(ns.is(\"guttered\"));\n }\n return [ns.b(), classes];\n });\n return (_ctx, _cache) => {\n return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {\n class: normalizeClass(unref(colKls)),\n style: normalizeStyle(unref(style))\n }, {\n default: withCtx(() => [renderSlot(_ctx.$slots, \"default\")]),\n _: 3\n }, 8, [\"class\", \"style\"]);\n };\n }\n});\nvar Col = /* @__PURE__ */_export_sfc(_sfc_main, [[\"__file\", \"col.vue\"]]);\nexport { Col as default };","map":{"version":3,"names":["name","gutter","inject","rowContextKey","computed","ns","useNamespace","style","styles","value","paddingLeft","paddingRight","colKls","classes","pos","forEach","prop","size","props","isNumber","push","b","sizes","isObject","Object","entries","sizeProp","is"],"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 setup lang=\"ts\">\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'\nimport { colProps } from './col'\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'ElCol',\n})\n\nconst props = defineProps(colProps)\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(`$
|