UNPKG

@wocwin/t-ui-plus

Version:

Page level components developed based on Element Plus.

228 lines (223 loc) 10.4 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); require('../../../hooks/index.js'); var useLocale = require('../../../hooks/useLocale.js'); const _hoisted_1 = { key: 0 }; const _hoisted_2 = { key: 1 }; const _hoisted_3 = { key: 0 }; const _hoisted_4 = { key: 1 }; var _sfc_main = /* @__PURE__ */ vue.defineComponent({ __name: "firstColumn", props: { table: {}, radioVal: {}, align: {}, isPaginationCumulative: { type: Boolean }, isShowPagination: { type: Boolean } }, emits: ["radioChange", "update:radioVal"], setup(__props, { emit: __emit }) { const { t } = useLocale.useLocale(); const props = __props; const emit = __emit; const localRadio = vue.computed({ get: () => props.radioVal, set: (val) => { emit("update:radioVal", val); } }); const radioHandleChange = (row, index) => { emit("radioChange", row, index); }; return (_ctx, _cache) => { const _component_el_table_column = vue.resolveComponent("el-table-column"); const _component_el_radio = vue.resolveComponent("el-radio"); return vue.openBlock(), vue.createElementBlock( vue.Fragment, null, [ !Array.isArray(_ctx.table.firstColumn) && _ctx.table.firstColumn ? (vue.openBlock(), vue.createElementBlock( vue.Fragment, { key: 0 }, [ _ctx.table.firstColumn.type === "selection" ? (vue.openBlock(), vue.createBlock( _component_el_table_column, vue.normalizeProps(vue.mergeProps({ key: 0 }, { type: "selection", width: _ctx.table.firstColumn.width || 55, label: _ctx.table.firstColumn.label, fixed: _ctx.table.firstColumn.fixed, align: _ctx.table.firstColumn.align || _ctx.align || "center", "reserve-selection": _ctx.table.firstColumn.isPaging || false, selectable: _ctx.table.firstColumn.selectable, ..._ctx.table.firstColumn.bind })), null, 16 /* FULL_PROPS */ )) : (vue.openBlock(), vue.createBlock( _component_el_table_column, vue.normalizeProps(vue.mergeProps({ key: 1 }, { type: _ctx.table.firstColumn.type, width: _ctx.table.firstColumn.width || 55, label: _ctx.table.firstColumn.label || _ctx.table.firstColumn.type === "radio" && vue.unref(t)("plus.table.fistColumn.radio") || _ctx.table.firstColumn.type === "index" && vue.unref(t)("plus.table.fistColumn.label") || _ctx.table.firstColumn.type === "expand" && "" || "", fixed: _ctx.table.firstColumn.fixed, align: _ctx.table.firstColumn.align || _ctx.align || "center", ..._ctx.table.firstColumn.bind })), vue.createSlots({ _: 2 /* DYNAMIC */ }, [ _ctx.table.firstColumn.type !== "selection" ? { name: "default", fn: vue.withCtx((scope) => [ _ctx.table.firstColumn.type === "radio" ? (vue.openBlock(), vue.createBlock(_component_el_radio, { key: 0, modelValue: localRadio.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => localRadio.value = $event), label: scope.$index + 1, disabled: scope.row.isRadioDisabled, onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => { }, ["stop"])), onChange: ($event) => radioHandleChange(scope.row, scope.$index + 1) }, null, 8, ["modelValue", "label", "disabled", "onChange"])) : vue.createCommentVNode("v-if", true), _ctx.table.firstColumn.type === "index" ? (vue.openBlock(), vue.createElementBlock( vue.Fragment, { key: 1 }, [ _ctx.isPaginationCumulative && _ctx.isShowPagination ? (vue.openBlock(), vue.createElementBlock( "span", _hoisted_1, vue.toDisplayString((_ctx.table.currentPage - 1) * _ctx.table.pageSize + scope.$index + 1), 1 /* TEXT */ )) : (vue.openBlock(), vue.createElementBlock( "span", _hoisted_2, vue.toDisplayString(scope.$index + 1), 1 /* TEXT */ )) ], 64 /* STABLE_FRAGMENT */ )) : vue.createCommentVNode("v-if", true), _ctx.table.firstColumn.type === "expand" ? vue.renderSlot(_ctx.$slots, "expand", { key: 2, scope }) : vue.createCommentVNode("v-if", true) ]), key: "0" } : void 0 ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */ )) ], 64 /* STABLE_FRAGMENT */ )) : vue.createCommentVNode("v-if", true), Array.isArray(_ctx.table.firstColumn) ? (vue.openBlock(true), vue.createElementBlock( vue.Fragment, { key: 1 }, vue.renderList(_ctx.table.firstColumn, (item, index) => { return vue.openBlock(), vue.createElementBlock( vue.Fragment, null, [ item.type === "selection" ? (vue.openBlock(), vue.createBlock( _component_el_table_column, vue.mergeProps({ key: index + 1 }, { type: "selection", width: item.width || 55, label: item.label, fixed: item.fixed, align: item.align || _ctx.align || "center", "reserve-selection": item.isPaging || false, selectable: item.selectable, ...item.bind }), null, 16 /* FULL_PROPS */ )) : (vue.openBlock(), vue.createBlock( _component_el_table_column, vue.mergeProps({ key: index + "k" }, { type: item.type, width: item.width || 55, label: item.label || item.type === "radio" && vue.unref(t)("plus.table.fistColumn.radio") || item.type === "index" && vue.unref(t)("plus.table.fistColumn.label") || item.type === "expand" && "" || "", fixed: item.fixed, align: item.align || _ctx.align || "center", ...item.bind }), vue.createSlots({ _: 2 /* DYNAMIC */ }, [ item.type !== "selection" ? { name: "default", fn: vue.withCtx((scope) => [ item.type === "radio" ? (vue.openBlock(), vue.createBlock(_component_el_radio, { key: 0, modelValue: localRadio.value, "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => localRadio.value = $event), label: scope.$index + 1, disabled: scope.row.isRadioDisabled, onClick: _cache[3] || (_cache[3] = vue.withModifiers(() => { }, ["stop"])), onChange: ($event) => radioHandleChange(scope.row, scope.$index + 1) }, null, 8, ["modelValue", "label", "disabled", "onChange"])) : vue.createCommentVNode("v-if", true), item.type === "index" ? (vue.openBlock(), vue.createElementBlock( vue.Fragment, { key: 1 }, [ _ctx.isPaginationCumulative && _ctx.isShowPagination ? (vue.openBlock(), vue.createElementBlock( "span", _hoisted_3, vue.toDisplayString((_ctx.table.currentPage - 1) * _ctx.table.pageSize + scope.$index + 1), 1 /* TEXT */ )) : (vue.openBlock(), vue.createElementBlock( "span", _hoisted_4, vue.toDisplayString(scope.$index + 1), 1 /* TEXT */ )) ], 64 /* STABLE_FRAGMENT */ )) : vue.createCommentVNode("v-if", true), item.type === "expand" ? vue.renderSlot(_ctx.$slots, "expand", { key: 2, scope }) : vue.createCommentVNode("v-if", true) ]), key: "0" } : void 0 ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */ )) ], 64 /* STABLE_FRAGMENT */ ); }), 256 /* UNKEYED_FRAGMENT */ )) : vue.createCommentVNode("v-if", true) ], 64 /* STABLE_FRAGMENT */ ); }; } }); exports.default = _sfc_main;