sohelp-ele
Version:
SohelpEle Library
165 lines (164 loc) • 5.93 kB
JavaScript
(function() {
"use strict";
try {
if (typeof document != "undefined") {
var elementStyle = document.createElement("style");
elementStyle.appendChild(document.createTextNode(""));
document.head.appendChild(elementStyle);
}
} catch (e) {
console.error("vite-plugin-css-injected-by-js", e);
}
})();
;
var render = function() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c("div", { staticStyle: { "display": "flex", "align-items": "center" } }, [_vm._l(_vm.toolbars, function(item) {
return [!item.buttonType || item.buttonType === "common" ? _c("el-button", { directives: [{ name: "permission", rawName: "v-permission", value: item.pno, expression: "item.pno" }], key: item.title, ref: item.title, refInFor: true, staticClass: "ele-btn-icon", attrs: { "icon": _vm._f("iconType")(item), "type": "primary", "loading": item.loading }, on: { "click": function($event) {
return _vm.operation(item);
} } }, [_vm._v(_vm._s(item.title))]) : _vm._e()];
}), _vm.more() ? _c("el-dropdown", [_c("el-button", { staticClass: "ele-btn-icon" }, [_c("span", [_vm._v("\u66F4\u591A")]), _c("i", { staticClass: "el-icon-arrow-down" })]), _c("el-dropdown-menu", { attrs: { "slot": "dropdown" }, slot: "dropdown" }, [_vm._l(_vm.toolbars, function(item) {
return [item.buttonType === "more" ? _c("el-dropdown-item", { directives: [{ name: "permission", rawName: "v-permission", value: item.pno, expression: "item.pno" }], key: item.title, on: { "click": function($event) {
return _vm.operation(item);
} } }, [_c("span", { on: { "click": function($event) {
return _vm.operation(item);
} } }, [_vm._v(_vm._s(item.title))])]) : _vm._e()];
})], 2)], 1) : _vm._e(), _vm.batch() ? _c("el-dropdown", [_c("el-button", { staticClass: "ele-btn-icon", attrs: { "disabled": !_vm.selection.length } }, [_c("span", [_vm._v("\u6279\u91CF\u64CD\u4F5C")]), _c("i", { staticClass: "el-icon-arrow-down" })]), _c("el-dropdown-menu", { attrs: { "slot": "dropdown" }, slot: "dropdown" }, [_vm._l(_vm.toolbars, function(item) {
return [item.buttonType === "batch" ? _c("el-dropdown-item", { directives: [{ name: "permission", rawName: "v-permission", value: item.pno, expression: "item.pno" }], key: item.title, on: { "click": function($event) {
return _vm.operation(item);
} } }, [_c("span", { on: { "click": function($event) {
return _vm.operation(item);
} } }, [_vm._v(_vm._s(item.title))])]) : _vm._e()];
})], 2)], 1) : _vm._e()], 2);
};
var staticRenderFns = [];
var TableToolbar_vue_vue_type_style_index_0_scoped_true_lang = "";
function normalizeComponent(scriptExports, render2, staticRenderFns2, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
if (render2) {
options.render = render2;
options.staticRenderFns = staticRenderFns2;
options._compiled = true;
}
if (functionalTemplate) {
options.functional = true;
}
if (scopeId) {
options._scopeId = "data-v-" + scopeId;
}
var hook;
if (moduleIdentifier) {
hook = function(context) {
context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
context = __VUE_SSR_CONTEXT__;
}
if (injectStyles) {
injectStyles.call(this, context);
}
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier);
}
};
options._ssrRegister = hook;
} else if (injectStyles) {
hook = shadowMode ? function() {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
);
} : injectStyles;
}
if (hook) {
if (options.functional) {
options._injectStyles = hook;
var originalRender = options.render;
options.render = function renderWithStyleInjection(h, context) {
hook.call(context);
return originalRender(h, context);
};
} else {
var existing = options.beforeCreate;
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
}
}
return {
exports: scriptExports,
options
};
}
const iconTypes = {
custom: "",
add: "el-icon-plus",
save: "el-icon-_save",
del: "el-icon-delete",
refresh: "el-icon-refresh-right",
copy: "el-icon-copy-document"
};
const __vue2_script = {
name: "TableToolbar",
props: {
toolbars: Array,
selection: Array
},
data() {
return {};
},
filters: {
iconType(item) {
if (item == null ? void 0 : item.iconCls)
return item.iconCls;
return iconTypes[item == null ? void 0 : item.type] || iconTypes.custom;
}
},
methods: {
operation(value) {
value.loading = true;
this.$emit("operation", value);
},
batch() {
var _a;
let data = false;
(_a = this.toolbars) == null ? void 0 : _a.forEach((e) => {
if (e.buttonType === "batch") {
data = true;
return;
}
});
return data;
},
more() {
var _a;
let data = false;
(_a = this.toolbars) == null ? void 0 : _a.forEach((e) => {
if (e.buttonType === "more") {
data = true;
return;
}
});
return data;
}
}
};
const __cssModules = {};
var __component__ = /* @__PURE__ */ normalizeComponent(
__vue2_script,
render,
staticRenderFns,
false,
__vue2_injectStyles,
"d3a0385c",
null,
null
);
function __vue2_injectStyles(context) {
for (let o in __cssModules) {
this[o] = __cssModules[o];
}
}
var TableToolbar = /* @__PURE__ */ function() {
return __component__.exports;
}();
module.exports = TableToolbar;