UNPKG

yanzhen-design-vue

Version:

167 lines (166 loc) 6.71 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const vue = require("vue"); const antDesignVue = require("ant-design-vue"); const components = require("@vueuse/components"); const list = require("./list.cjs"); const useList = require("./use-list.cjs"); const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...{ name: list.listName }, __name: "list", props: list.listProps, emits: list.listEmits, setup(__props, { emit: __emit }) { const { ns } = list.listOptions; const props = __props; const emit = __emit; const { ctx: { mode, _ref, _itemRef, _boxRef, _headerRef, _mainRef, _footerRef, wrapClass, wrapStyle, styles, $slots, _dataSource, _loading, mainHeight, virtualOptions }, templates: { DefineEmptyTemplate, ReusableEmptyTemplate, DefineItemTemplate, ReusableItemTemplate } } = useList.useList(props, emit); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [ vue.createVNode(vue.unref(DefineEmptyTemplate), null, { default: vue.withCtx(({ loading, empty }) => [ loading ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Spin), { key: 0, class: vue.normalizeClass([vue.unref(ns).e("loading")]), indicator: "" }, null, 8, ["class"])) : empty ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Empty), { key: 1, class: vue.normalizeClass([vue.unref(ns).e("empty")]), image: vue.unref(antDesignVue.Empty).PRESENTED_IMAGE_SIMPLE }, null, 8, ["class", "image"])) : vue.createCommentVNode("", true), vue.renderSlot(_ctx.$slots, "empty-wrapper") ]), _: 3 }), vue.createVNode(vue.unref(DefineItemTemplate), null, { default: vue.withCtx(({ item, index, ...record }) => [ vue.createElementVNode("div", { ref_key: "_itemRef", ref: _itemRef, class: vue.normalizeClass([vue.unref(ns).e("item"), record.class]) }, [ vue.renderSlot(_ctx.$slots, "default", { item, index }), vue.unref($slots).footer && index === vue.unref(_dataSource).length - 1 ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, ref_key: "_footerRef", ref: _footerRef, class: vue.normalizeClass([vue.unref(ns).e("item"), vue.unref(ns).e("footer")]), style: vue.normalizeStyle(vue.unref(styles).footer) }, [ vue.renderSlot(_ctx.$slots, "footer") ], 6)) : vue.createCommentVNode("", true) ], 2) ]), _: 3 }), vue.createElementVNode("div", { ref_key: "_boxRef", ref: _boxRef, class: vue.normalizeClass(vue.unref(wrapClass)), style: vue.normalizeStyle(vue.unref(wrapStyle)) }, [ vue.unref($slots).header ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, ref_key: "_headerRef", ref: _headerRef, class: vue.normalizeClass([vue.unref(ns).e("header")]), style: vue.normalizeStyle(vue.unref(styles).header) }, [ vue.renderSlot(_ctx.$slots, "header", { props }) ], 6)) : vue.createCommentVNode("", true), vue.createElementVNode("div", { ref_key: "_mainRef", ref: _mainRef, class: vue.normalizeClass([vue.unref(ns).e("main")]) }, [ vue.unref(_dataSource).length === 0 ? (vue.openBlock(), vue.createBlock(vue.unref(ReusableEmptyTemplate), { key: 0, loading: vue.unref(_loading), empty: true }, null, 8, ["loading"])) : vue.createCommentVNode("", true), vue.unref($slots).tree ? (vue.openBlock(), vue.createElementBlock("div", { key: 1, class: vue.normalizeClass([vue.unref(ns).e("scroll")]) }, [ vue.renderSlot(_ctx.$slots, "tree", { dataSource: vue.unref(_dataSource), height: vue.unref(mainHeight), props }) ], 2)) : vue.unref(mode) === "virtual" ? (vue.openBlock(), vue.createBlock(vue.unref(components.UseVirtualList), { key: 2, ref_key: "_ref", ref: _ref, class: vue.normalizeClass([vue.unref(ns).e("scroll"), vue.unref(ns).e("virtual")]), style: { height: "100%" }, options: vue.unref(virtualOptions), list: vue.unref(_dataSource) }, { default: vue.withCtx(({ data: item, index }) => [ vue.createVNode(vue.unref(ReusableItemTemplate), { class: vue.normalizeClass([vue.unref(ns).e("virtual-item")]), item, index }, null, 8, ["class", "item", "index"]) ]), _: 1 }, 8, ["class", "options", "list"])) : (vue.openBlock(), vue.createElementBlock("div", { key: 3, ref_key: "_ref", ref: _ref, class: vue.normalizeClass([vue.unref(ns).e("scroll")]) }, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(_dataSource), (item, index) => { return vue.openBlock(), vue.createBlock(vue.unref(ReusableItemTemplate), { key: (item == null ? void 0 : item.value) ?? index, class: vue.normalizeClass([vue.unref(ns).e("default-item")]), item, index }, null, 8, ["class", "item", "index"]); }), 128)) ], 2)) ], 2), vue.unref($slots).tree && vue.unref($slots).footer ? (vue.openBlock(), vue.createElementBlock("div", { key: 1, ref_key: "_footerRef", ref: _footerRef, class: vue.normalizeClass([vue.unref(ns).e("footer")]), style: vue.normalizeStyle(vue.unref(styles).footer) }, [ vue.renderSlot(_ctx.$slots, "footer", { props }) ], 6)) : vue.createCommentVNode("", true) ], 6) ], 64); }; } }); exports.default = _sfc_main;