UNPKG

winbox-ui-next

Version:

We Design Vue 2.0: A Vue.js 3 UI Library

118 lines (117 loc) 4.91 kB
import { defineComponent, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, createBlock, createCommentVNode, toDisplayString } from "vue"; import { isFunction } from "../../_utils/is.js"; import IconLeft from "../../icon/icon-left/index.js"; import IconRight from "../../icon/icon-right/index.js"; import IconDoubleLeft from "../../icon/icon-double-left/index.js"; import IconDoubleRight from "../../icon/icon-double-right/index.js"; import RenderFunction from "../../_components/render-function.js"; import _export_sfc from "../../_virtual/plugin-vue_export-helper"; const _sfc_main = defineComponent({ name: "PanelHeader", components: { IconLeft, IconRight, IconDoubleLeft, IconDoubleRight, RenderFunction }, props: { prefixCls: { type: String, required: true }, title: { type: String, required: true }, icons: { type: Object }, onPrev: { type: Function }, onSuperPrev: { type: Function }, onNext: { type: Function }, onSuperNext: { type: Function } }, setup(props) { return { showPrev: computed(() => isFunction(props.onPrev)), showSuperPrev: computed(() => isFunction(props.onSuperPrev)), showNext: computed(() => isFunction(props.onNext)), showSuperNext: computed(() => isFunction(props.onSuperNext)), getIconClassName: (show) => [ `${props.prefixCls}-header-icon`, { [`${props.prefixCls}-header-icon-hidden`]: !show } ] }; } }); function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_RenderFunction = resolveComponent("RenderFunction"); const _component_IconDoubleLeft = resolveComponent("IconDoubleLeft"); const _component_IconLeft = resolveComponent("IconLeft"); const _component_IconRight = resolveComponent("IconRight"); const _component_IconDoubleRight = resolveComponent("IconDoubleRight"); return openBlock(), createElementBlock("div", { class: normalizeClass(`${_ctx.prefixCls}-header`) }, [ createElementVNode("div", { class: normalizeClass(_ctx.getIconClassName(_ctx.showSuperPrev)), onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onSuperPrev && _ctx.onSuperPrev(...args)) }, [ _ctx.showSuperPrev ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ _ctx.icons && _ctx.icons.prevDouble ? (openBlock(), createBlock(_component_RenderFunction, { key: 0, "render-func": _ctx.icons && _ctx.icons.prevDouble }, null, 8, ["render-func"])) : (openBlock(), createBlock(_component_IconDoubleLeft, { key: 1 })) ], 2112)) : createCommentVNode("v-if", true) ], 2), createElementVNode("div", { class: normalizeClass(_ctx.getIconClassName(_ctx.showPrev)), onClick: _cache[1] || (_cache[1] = (...args) => _ctx.onPrev && _ctx.onPrev(...args)) }, [ _ctx.showPrev ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ _ctx.icons && _ctx.icons.prev ? (openBlock(), createBlock(_component_RenderFunction, { key: 0, "render-func": _ctx.icons && _ctx.icons.prev }, null, 8, ["render-func"])) : (openBlock(), createBlock(_component_IconLeft, { key: 1 })) ], 2112)) : createCommentVNode("v-if", true) ], 2), createElementVNode("div", { class: normalizeClass(`${_ctx.prefixCls}-header-title`) }, toDisplayString(_ctx.title), 3), createElementVNode("div", { class: normalizeClass(_ctx.getIconClassName(_ctx.showNext)), onClick: _cache[2] || (_cache[2] = (...args) => _ctx.onNext && _ctx.onNext(...args)) }, [ _ctx.showNext ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ _ctx.icons && _ctx.icons.next ? (openBlock(), createBlock(_component_RenderFunction, { key: 0, "render-func": _ctx.icons && _ctx.icons.next }, null, 8, ["render-func"])) : (openBlock(), createBlock(_component_IconRight, { key: 1 })) ], 2112)) : createCommentVNode("v-if", true) ], 2), createElementVNode("div", { class: normalizeClass(_ctx.getIconClassName(_ctx.showSuperNext)), onClick: _cache[3] || (_cache[3] = (...args) => _ctx.onSuperNext && _ctx.onSuperNext(...args)) }, [ _ctx.showSuperNext ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ _ctx.icons && _ctx.icons.nextDouble ? (openBlock(), createBlock(_component_RenderFunction, { key: 0, "render-func": _ctx.icons && _ctx.icons.nextDouble }, null, 8, ["render-func"])) : (openBlock(), createBlock(_component_IconDoubleRight, { key: 1 })) ], 2112)) : createCommentVNode("v-if", true) ], 2) ], 2); } var PanelHeader = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); export { PanelHeader as default };