birdpaper-ui
Version:
一个通用的 vue3 UI组件库。A common vue3 UI component library.
57 lines (56 loc) • 2.31 kB
JavaScript
;
const vue = require("vue");
const colGroup_vue_vue_type_script_setup_true_name_TableColumns_lang = require("./col-group.vue.js");
const _hoisted_1 = { class: "bp-table-header-thead" };
const __default__ = vue.defineComponent({
name: "TableHeader"
});
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...__default__,
props: {
headerList: { type: Array, default: () => [] }
},
emits: ["on-select-all"],
setup(__props, { expose: __expose, emit: emits }) {
const thClass = (item) => {
let align = `text-${item["headerAlign"] || item["align"] || "left"}`;
let name = ["bp-table-th", align];
return name;
};
const isSelectAll = vue.ref(false);
const onSelectChange = () => {
emits("on-select-all", isSelectAll.value);
};
__expose({
isSelectAll
});
return (_ctx, _cache) => {
const _component_bp_checkbox = vue.resolveComponent("bp-checkbox");
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
vue.createVNode(colGroup_vue_vue_type_script_setup_true_name_TableColumns_lang, { cols: __props.headerList }, null, 8, ["cols"]),
vue.createElementVNode("thead", _hoisted_1, [
vue.createElementVNode("tr", null, [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.headerList, (item) => {
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
item.type === "checkbox" ? (vue.openBlock(), vue.createElementBlock("th", {
key: 0,
class: vue.normalizeClass(thClass(item))
}, [
vue.createVNode(_component_bp_checkbox, {
modelValue: isSelectAll.value,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isSelectAll.value = $event),
onChange: onSelectChange
}, null, 8, ["modelValue"])
], 2)) : (vue.openBlock(), vue.createElementBlock("th", {
key: 1,
class: vue.normalizeClass(thClass(item))
}, vue.toDisplayString(item.title), 3))
], 64);
}), 256))
])
])
], 64);
};
}
});
module.exports = _sfc_main;