UNPKG

@fe6/water-pro

Version:

An enterprise-class UI design language and Vue-based implementation

127 lines (97 loc) 4.99 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _vue = require("vue"); var _iconsVue = require("@ant-design/icons-vue/lib/icons"); var _basicTitle = require("../basic-title"); var _basicArrow = require("../basic-arrow"); var _useConfigInject2 = _interopRequireDefault(require("../_util/hooks/useConfigInject")); var _vueTypes = _interopRequireDefault(require("../_util/vue-types")); var _propsUtil = require("../_util/props-util"); var _type = require("../_util/type"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var _default2 = (0, _vue.defineComponent)({ inheritAttrs: false, props: { title: _vueTypes.default.string, show: _vueTypes.default.bool, expanable: _vueTypes.default.bool, loading: _vueTypes.default.bool, prefixCls: _vueTypes.default.string, mode: _vueTypes.default.oneOf((0, _type.tuple)('simple', 'default')).def('default'), headerClassName: _vueTypes.default.string }, emits: ['expand'], setup: function setup(props) { var _useConfigInject = (0, _useConfigInject2.default)('container-collapse', props), prefixClsNew = _useConfigInject.prefixCls; return { prefixClsNew: prefixClsNew }; }, render: function render() { var _ref, _this = this; var titleNode = this.title; var children = (0, _propsUtil.getSlot)(this); if (children.length > 0) { titleNode = children.slice(); } var loadingNode = null; if (this.loading) { loadingNode = (0, _vue.createVNode)(_iconsVue.LoadingOutlined, null, null); } var slotDatas = { status: this.show }; var actionNode = null; var actionChildren = (0, _propsUtil.getSlot)(this, 'action', slotDatas); if (actionChildren.length > 0) { actionNode = actionChildren.slice(); } var arrowNode = null; if (!this.loading && this.expanable) { arrowNode = (0, _vue.createVNode)(_basicArrow.BasicArrow, { "top": this.show, "helpMessage": this.show ? '收起' : '展开', "expand": !this.show }, null); var iconChildren = (0, _propsUtil.getSlot)(this, 'icon', slotDatas); if (iconChildren.length) { arrowNode = iconChildren; } } var actionAfterDefaultNode = (0, _vue.createVNode)("div", { "class": "".concat(this.prefixClsNew, "-action ").concat(this.prefixClsNew, "-action-").concat(this.mode).concat(this.headerClassName ? " ".concat(this.headerClassName) : '') }, [actionNode, loadingNode, arrowNode]); var actionBeforeDefaultNode = (0, _vue.createVNode)("div", { "class": "".concat(this.prefixClsNew, "-action ").concat(this.prefixClsNew, "-action-").concat(this.mode).concat(this.headerClassName ? " ".concat(this.headerClassName) : '') }, [arrowNode, actionNode, loadingNode]); var afterActionNode = null; if (this.mode === 'default') { afterActionNode = actionAfterDefaultNode; } var beforeActionNode = null; if (this.mode === 'simple') { beforeActionNode = actionBeforeDefaultNode; } return (0, _vue.createVNode)("div", { "class": ["".concat(this.prefixClsNew, "-header"), (_ref = {}, _defineProperty(_ref, "".concat(this.prefixClsNew, "-header-active"), this.show), _defineProperty(_ref, "".concat(this.prefixClsNew, "-header-only"), !this.expanable), _ref), "".concat(this.prefixClsNew, "-header-").concat(this.mode)], "onClick": function onClick() { return _this.$emit('expand'); } }, [beforeActionNode, (0, _vue.createVNode)(_basicTitle.BasicTitle, _objectSpread({ "class": "".concat(this.prefixClsNew, "-header-title") }, this.$attrs), { default: function _default() { return [titleNode]; } }), afterActionNode]); } }); exports.default = _default2;