winbox-ui-next
Version:
We Design Vue 2.0: A Vue.js 3 UI Library
53 lines (52 loc) • 1.66 kB
JavaScript
import { defineComponent, openBlock, createElementBlock, Fragment, renderList, normalizeClass, normalizeStyle } from "vue";
import _export_sfc from "../_virtual/plugin-vue_export-helper";
const _sfc_main = defineComponent({
name: "ColGroup",
props: {
dataColumns: {
type: Array,
required: true
},
operations: {
type: Array,
required: true
},
columnWidth: {
type: Object
}
},
setup() {
const fixedWidth = (width) => {
if (width) {
return {
width: `${width}px`,
minWidth: `${width}px`,
maxWidth: `${width}px`
};
}
return void 0;
};
return {
fixedWidth
};
}
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("colgroup", null, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.operations, (item) => {
return openBlock(), createElementBlock("col", {
key: `w-col-${item.name}`,
class: normalizeClass(`w-table-${item.name}-col`),
style: normalizeStyle(_ctx.fixedWidth(item.width))
}, null, 6);
}), 128)),
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dataColumns, (item) => {
return openBlock(), createElementBlock("col", {
key: `w-col-${item.dataIndex}`,
style: normalizeStyle(_ctx.fixedWidth(_ctx.columnWidth && item.dataIndex && _ctx.columnWidth[item.dataIndex] || item.width))
}, null, 4);
}), 128))
]);
}
var ColGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export { ColGroup as default };