UNPKG

@arco-vue-pro-components/pro-components

Version:
56 lines (55 loc) 1.73 kB
"use strict"; var vue = require("vue"); var webVue = require("@arco-design/web-vue"); var index$1 = require("../../locale/index.js"); var context = require("../form/context.js"); var index$2 = require("../my-tool-tip/index.js"); var index = require("../my-icon/index.js"); function _isSlot(s) { return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s); } const DensityIcon = (props) => { const tableCtx = vue.inject(context.proTableInjectionKey, {}); const { icon = vue.createVNode(index, { "type": "icon-colum-height" }, null) } = props; const { getMessage } = index$1.useI18n(); const items = [{ key: "large", label: getMessage("tableToolBar.densityLarger", "\u9ED8\u8BA4") }, { key: "medium", label: getMessage("tableToolBar.densityMiddle", "\u4E2D\u7B49") }, { key: "small", label: getMessage("tableToolBar.densitySmall", "\u7D27\u51D1") }]; return vue.createVNode(webVue.Dropdown, { "onSelect": (key) => { var _a; (_a = tableCtx == null ? void 0 : tableCtx.setTableSize) == null ? void 0 : _a.call(tableCtx, key); }, "popupContainer": tableCtx == null ? void 0 : tableCtx.popupContainer, "trigger": "click" }, { default: () => [vue.createVNode(index$2, { "content": getMessage("tableToolBar.density") }, _isSlot(icon) ? icon : { default: () => [icon] })], content: () => { return items.map((item) => vue.createVNode(webVue.Dropdown.Option, { "active": tableCtx.tableSize === item.key, "value": item.key, "key": item.key }, { default: () => [item.label] })); } }); }; module.exports = DensityIcon;