UNPKG

birdpaper-ui

Version:

一个通用的 vue3 UI组件库。A common vue3 UI component library.

103 lines (102 loc) 4.77 kB
import _sfc_main from "./table.vue2.js"; import { resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, normalizeStyle, createVNode, renderSlot, createElementBlock, Fragment, renderList, toDisplayString } from "vue"; import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js"; const _hoisted_1 = { class: "bp-table", ref: "bpTable" }; const _hoisted_2 = /* @__PURE__ */ createElementVNode("div", { class: "scrollbar" }, null, -1); const _hoisted_3 = { key: 2, class: "bp-table-body-tbody" }; const _hoisted_4 = { key: 1, class: "bp-table-td-content" }; const _hoisted_5 = { key: 0 }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_table_header = resolveComponent("table-header"); const _component_table_empty = resolveComponent("table-empty"); const _component_table_body = resolveComponent("table-body"); const _component_table_select = resolveComponent("table-select"); const _component_bp_spin = resolveComponent("bp-spin"); return openBlock(), createBlock(_component_bp_spin, { loading: _ctx.loading }, { default: withCtx(() => [ createElementVNode("div", _hoisted_1, [ createElementVNode("div", { class: normalizeClass(_ctx.innerClass) }, [ createElementVNode("div", { class: "bp-table-body-area", style: normalizeStyle(_ctx.bodyAreaStyle) }, [ _hoisted_2, createElementVNode("table", { class: "bp-table-body", style: normalizeStyle(`width:${_ctx.table_width}px`) }, [ createVNode(_component_table_header, { ref: "tableHeaderRef", "header-list": _ctx.columns, onOnSelectAll: _ctx.onSelectAll }, null, 8, ["header-list", "onOnSelectAll"]), _ctx.isEmpty ? (openBlock(), createBlock(_component_table_empty, { key: 0, colspan: _ctx.columns.length }, null, 8, ["colspan"])) : !_ctx.isEmpty && _ctx.slots.columns ? (openBlock(), createBlock(_component_table_body, { key: 1, modelValue: _ctx.selectedData, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.selectedData = $event), data: _ctx.data, selection: _ctx.selection, "row-key": _ctx.rowKey, onChange: _ctx.onSelectChange }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "columns") ]), _: 3 }, 8, ["modelValue", "data", "selection", "row-key", "onChange"])) : (openBlock(), createElementBlock("tbody", _hoisted_3, [ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data, (item, index) => { return openBlock(), createElementBlock("tr", { key: `bp-table-tbody-tr-${index}` }, [ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (v, k) => { return openBlock(), createElementBlock("td", { key: `bp-table-tbody-td-${index}-${k}`, class: normalizeClass(_ctx.tdClass(v)) }, [ ["radio", "checkbox"].includes(v.type) ? (openBlock(), createBlock(_component_table_select, { key: 0, modelValue: _ctx.selectedData, "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.selectedData = $event), type: v.type, record: item, value: item[_ctx.rowKey], onChange: _ctx.onSelectChange }, null, 8, ["modelValue", "type", "record", "value", "onChange"])) : (openBlock(), createElementBlock("span", _hoisted_4, [ !v.scope ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(item[v.dataIndex]), 1)) : renderSlot(_ctx.$slots, v.scope.customRender, { key: 1, row: item, index, data: item[v.dataIndex] }) ])) ], 2); }), 128)) ]); }), 128)) ])) ], 4) ], 4) ], 2) ], 512) ]), _: 3 }, 8, ["loading"]); } const _table = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); export { _table as default };